Wanted to separate a data in php

0

<?php 
  if(isset($_GET['acao'])){?>
       <?php  $acao = $_GET['acao'];
       switch ($acao) {
       	case 'buscar':
      		 	
       		 	$dados = array( 
				 array(
	   							"video"  => 'LWzwjcgh7_A',
	   							"imagem" => 'https://i.ytimg.com/vi/LWzwjcgh7_A/mqdefault.jpg',
	   							"titulo" => 'Amado Batista Princesa',
	   							"subtitulo" => 'Dados do video',
	   						 ),
	   		); 
       		break;
       	default:
       		# code...
       		break;
       }
	   echo(json_encode($dados));
	}
 ?>

I wanted to separate this part I'm going to loop here I'll duplicate

 array(
                            "video"  => 'LWzwjcgh7_A',
                            "imagem" => 'https://i.ytimg.com/vi/LWzwjcgh7_A/mqdefault.jpg',
                            "titulo" => 'Amado Batista Princesa',
                            "subtitulo" => 'Dados do video',
                         ),
    
asked by anonymous 01.03.2018 / 08:10

1 answer

0

There is an error at the beginning of the code:

<?php 
  if(isset($_GET['acao'])){?>

This sign at the end ? > closes the PHP TAG, that is, the following is going to be just HTML text.

To separate ARRAY following the logic of your code:

echo $dados['video']; // results LWzwjcgh7_A

echo $dados['imagem']; // link

echo $dados['titulo']; // Beloved Baptist Princess

echo $dados['subtitulo']; // Video data

    
01.03.2018 / 11:32