Home >Backend Development >PHP Tutorial >How to call when the key name of json is a number (sample code)_PHP tutorial
When the key name is a number or an abnormal variable character (if there is a space), the obj[xx] method must be used to obtain the value.
//Declare json data
$array = array('result'=>array("90"=>"90 queue","status"=>"Success"));
$json = json_encode($array);
$array1 = array("90"=>"90 Queue","status"=>"Success");
$json1 = json_encode($array1);
$phpjson = json_decode( $json1,true);//The second parameter is true, which means converting json data into an array
//When the json key name is a number, it can only be processed in array mode $phpjson['90'];
?>