我想我的爆炸阵列看起来像这样:PHP爆炸阵列阵列具有四个细胞
[0] => Array
(
[0] => 14 // this is hours
[1] => 38 // this is minutes
[2] => 14 // this is hours again
[3] => 59 // this is minutes again
)
[1] => Array
(
[0] => 15 // this is hours
[1] => 10 // this is minutes
[2] => 16 // this is hours again
[3] => 40 // this is minutes again
)
.
.
.
[200] => Array
(
[0] => 13 // this is hours
[1] => 35 // this is minutes
[2] => 23 // this is hours again
[3] => 32 // this is minutes again
)
这个,因为我将在未来这些时间进行比较。
我有这样的时间的列表:
15:48,16:10 12:01,12:19 13:06,13:28 10:45,11:02
,现在我明白了一个数组,它看起来像这样的:
[0] => 16:10,16:36
[1] => 13:06,13:17
.
.
.
[200] => 14:38,14:59
我曾尝试迄今
$length = count($timesArr);
for($i=0; $i < $length; $i++){
foreach (explode(',', $timesArr[$i]) as $piece) {
$timesArray[] = explode(':', $piece);
}
}
和因为结果输出是这样的,这是相当接近:
[0] => Array
(
[0] => 14
[1] => 38
)
[1] => Array
(
[0] => 14
[1] => 59
)
所以再次主要问题是,我所需要的细胞在0和1的上方作为认为是在同一小区
我也可以直接从字符串去,所以我会爆炸字符串。
你可以使用'preg_replace_callback()'来处理它的正则表达式 – Martijn