我读过这样的字符串:
$var = '[["tom",10,17.5],["af",13,["x",10,"y",12,"z",11]]]';
我应该如何将此字符串转换为PHP数组?
答案 0 :(得分:0)
看起来像JSON。使用json_decode
。
答案 1 :(得分:-1)
<?php
$json = "[["tom",10,17.5],["af",13,["x",10,"y",12,"z",11]]]";
$obj = json_decode($json);
print $obj->{'tom'};
?>