使用php某些函数的注意事项

1,unset使用后数据结构改变

foreach ($getBlockData as $i => $val) {
    if (!in_array($val['tid'], $tid)) {
        unset($getBlockData[$i]);
    }
}

返回结果:

使用array_values函数解决返回结果为:

猜你喜欢

转载自blog.csdn.net/Baron0071/article/details/83411837