更新时间:2023-12-04 14:01:40
如何比较不存在的数组字段?
How can you compare non-existing array fields?
没有$ num ['b']字段,有这些字段,其数组[4] (index 0..3)
there is no $num['b'] field, there are these fields, its array[4] (index 0..3)
$num
在第一次迭代中将保持不变
$num
in first iteration will hold
array("a"=>1);
因此,如果您想与"b":2
进行比较,则必须使用以下模式:
so if you wanna compare to "b":2
you have to use this pattern:
$cmpr = array_shift($json);
...
if($num != $cmpr)
Array_shift: http://php.net/manual/zh/function. array-shift.php
Array_shift : http://php.net/manual/en/function.array-shift.php