I have multiple arrays which I'm trying to explode and divide all information inside. For some reason, I'm losing the information about main arrays when I do that.
Arrays
[0] => Array (
[0] => 2020-11-01 / 2020-11-30
[1] => 2020-12-01 / 2020-12-31
)
[1] => Array (
[0] => 2020-11-01 / 2020-11-30
[1] => 2020-12-01 / 2020-12-31
)
I used the following code:
foreach ($list as $line) {
foreach ($line as $text) {
$parts[] = explode(' / ', $text);
}
}
print_r($parts) will return the following:
[0] => Array (
[0] => 2020-11-01
[1] => 2020-11-30
)
[1] => Array (
[0] => 2020-12-01
[1] => 2020-12-31
)
[2] => Array (
[0] => 2020-11-01
[1] => 2020-11-30
)
[3] => Array (
[0] => 2020-12-01
[1] => 2020-12-31
)
but this is unfortunately not what I'm looking for, what I need is this:
[0] => Array (
[0] => Array (
[0] => 2020-11-01
[1] => 2020-11-30
)
[1] => Array (
[0] => 2020-12-01
[1] => 2020-12-31
)
)
[1] => Array (
[0] => Array (
[0] => 2020-11-01
[1] => 2020-11-30
)
[1] => Array (
[0] => 2020-12-01
[1] => 2020-12-31
)
)
I searched all around but did not find an easy way for that. hope somebody can help. thank you!
$zvariable?