php数组和js数组遍历
程序员文章站
2022-03-21 22:01:26
...
js for(key in arr){ console.log(arr[ key ] = arr[key]); } php $arr = array(k1:v1,k2:2); for($arr as $k=$v){ echo $k . = . $v . br/; }
js
for(key in arr){
console.log("arr[" + key + "] = " + arr[key]);
}
php
$arr = array("k1":"v1","k2":2);
for($arr as $k=>$v){
echo $k . " = " . $v . "
";
}