将字符串数组转换为数组 php
convert string array to array php
我有这样的字符串
{"status":"2","holding":"","company":"Company","nik":"8981237","name":"Markonah","ownercard":"Istri"}
如何在 PHP
中将此字符串转换为关联数组
它的 JSON,转换为数组使用 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
我有这样的字符串
{"status":"2","holding":"","company":"Company","nik":"8981237","name":"Markonah","ownercard":"Istri"}
如何在 PHP
中将此字符串转换为关联数组它的 JSON,转换为数组使用 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