zakinster
0
Q:

php json encode

$personJSON = '{"name":"Johny Carson","title":"CTO"}';

$person = json_decode($personJSON);

echo $person->name; // Johny Carson
8
$person = array( 
    "name" => "Johny Carson", 
    "title" => "CTO"
); 
$personJSON=json_encode($person);//returns JSON string
8

  <?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");

  
echo json_encode($age);
?>
 
0

New to Communities?

Join the community