希望每个人都做得很好...
我正在寻找类似于array_chunk()
但使用空值作为分隔符的东西?
我有 -
Array
(
[0] => /some/path:
[1] => file.csv
[2] => file.dat
[3] =>
[4] => /some/other/path:
[5] => file.csv
[6] => file.csv.gz
[7] => file.dat
[8] =>
[9] => /some/other/other/path:
[10] => file.csv
[11] => file.dat
)
并希望实现——
Array
(
[0] => Array
(
[0] => /some/path:
[1] => file.csv
[2] => file.dat
)
[1] => Array
(
[0] => /some/other/path:
[1] => file.csv
[2] => file.csv.gz
[3] => file.dat
)
[2] => Array
(
[0] => /some/other/other/path:
[1] => file.csv
[2] => file.dat
)
)
现在我不能每 3 个分块,因为您可以看到某些位置将有超过 1 个文件。
我可以通过循环和计数器来实现,但我认为会有更清洁的方法?
谢谢