1,代码:
<?php header("Content-type:text/html;charset=utf-8"); function va($value){ echo "<pre>"; var_dump($value); echo "</pre>"; } function edump($value){ va($value); exit(); } function jdump($value){ va($value); echo json_encode($value,true); exit(); } $arr1 = array(‘a‘,‘b‘,‘c‘); $arr2 = array(1=>‘a‘,2=>‘b‘,3=>‘c‘); // jdump($arr1); jdump($arr2);
输出结果:
jdump($arr1) :
array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } ["a","b","c"]
jdump($arr2) :
array(3) { [1]=> string(1) "a" [2]=> string(1) "b" [3]=> string(1) "c" } {"1":"a","2":"b","3":"c"}
时间: 2024-10-13 23:58:37