return while tesults php as json code example
Example 1: php return json
header('Content-type: application/json');
echo json_encode($array);
Example 2: php json encode
$person = array(
"name" => "Johny Carson",
"title" => "CTO"
);
$personJSON=json_encode($person);//returns JSON string