User2018
0
Q:

json_encode php

<?php
$data = ['name' => 'John', 'age' => 35];
header('Content-type: Application/json');
echo json_encode($data);
1
$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