$ch = curl_init($url);
$result = curl_exec($ch);
this is the result
{"response":"1", "name":"john", "id":22, "again":0, "text":xe};
Before echoing it in the js file via ajax I want to format it so I only get the data which i want to use which is id and name but its outputting the wrog data
$data = array();
$data[] = array("id"=>$result.'id', "name"=>$result.'name');
echo $data;
data it prints
( [0] => Array ( [id] => 1id and so on