$array = array("Real" => array("Alonso","Zidan"),"Inter" => "Zanetti", "Roma" => "Toti");
$json=json_encode($array);
echo $json
By this way I am reading all the data, but how can I read the data of
only Real
or Inter
?
For example, if it is json_decoded I can do so:
-
For
Inter
:echo $array['Inter'];
-
For
Real
:foreach($array["Real"] as $real){ echo $real."<br>"; }
How can I do the same with json_encode()
?