Reputation: 55
I have string like this
{"status":"2","holding":"","company":"Company","nik":"8981237","name":"Markonah","ownercard":"Istri"}
how to convert this string to associative array in PHP
Upvotes: 1
Views: 10193
Reputation: 1436
Its JSON, to convert to array use json_decode()
:
$string = '{"status":"2","holding":"","company":"Company","nik":"8981237","name":"Markonah","ownercard":"Istri"}';
$my_array = json_decode($string,true);
echo $my_array["status"]; // output: 2
Upvotes: 11