delete item in an array of arrays
This question already has an answer here:
There are multiple way to remove an element from an Array
unset(ARRAY)
$myArray = ['a', 'b', 'c'];
unset($myArray[1]);
output:
Array (
[0] => a
[1] => c
)
array_splice(ARRAY, OFFSET, LENGTH)
array_splice($myArray, 1, 1);
or you can use array_diff()
, if you know the values of the array.
$newArray = array_diff($myArray, ["a", "c"]);
See for more about array_diff()
链接地址: http://www.djcxy.com/p/30120.html上一篇: 在PHP中返回关联数组的第一个键
下一篇: 删除数组数组中的项目