开发者

How to convert JavaScript statement to PHP array

I read have one string like this:

$var = '[["tom",10,17.5],["af",13,["x",10,"y",12,"z",11]]]';

How should I convert this string to a PHP 开发者_如何学Carray?


That looks like JSON. Use json_decode.


<?php

$json = "[["tom",10,17.5],["af",13,["x",10,"y",12,"z",11]]]";

$obj = json_decode($json);
print $obj->{'tom'}; 
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜