取消设置多维数组中的列
2022-08-31 00:17:12
我有这个数组$output看起来像这样:
Array(
[0] => Array(
[0] => 1a
[1] => 1b
[2] => 1c
)
[1] => Array(
[0] => 2a
[1] => 2b
[2] => 2c
)
[2] => Array(
[0] => 3a
[1] => 3b
[2] => 3c
)
[3] => Array(
[0] => 4a
[1] => 4b
[2] => 4c
)
)
等等...
当我想删除第二个元素时,我只使用:
$output = unset($output[1]);
以获取以下内容:
Array(
[0] => Array(
[0] => 1a
[1] => 1b
[2] => 1c
)
[1] => Array(
[0] => 3a
[1] => 3b
[2] => 3c
)
[2] => Array(
[0] => 4a
[1] => 4b
[2] => 4c
)
)
我的问题是如何删除数组中每个元素的每一个第二个元素([0][1],[1][1],[2][1],[3][1],...)以获得以下内容:
Array(
[0] => Array(
[0] => 1a
[1] => 1c
)
[1] => Array(
[0] => 2a
[1] => 2c
)
[2] => Array(
[0] => 3a
[1] => 3c
)
[3] => Array(
[0] => 4a
[1] => 4c
)
)