<?php
$str = "1;bla.jpg;nature
2;;earth";
$arr = explode(PHP_EOL, $str);
Foreach($arr as &$line) $line = explode(";", $line);
Var_dump($arr);
- Output for 5.2.1 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- array(2) {
[0]=>
array(3) {
[0]=>
string(1) "1"
[1]=>
string(7) "bla.jpg"
[2]=>
string(6) "nature"
}
[1]=>
&array(3) {
[0]=>
string(1) "2"
[1]=>
string(0) ""
[2]=>
string(5) "earth"
}
}
- Output for 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
- array(2) {
[0]=>
&array(3) {
[0]=>
string(1) "1"
[1]=>
string(7) "bla.jpg"
[2]=>
string(6) "nature"
}
[1]=>
&array(3) {
[0]=>
string(1) "2"
[1]=>
string(0) ""
[2]=>
string(5) "earth"
}
}
- Output for 5.0.0 - 5.0.1
- Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/9FdVQ on line 6
array(1) {
[0]=>
&array(5) {
[0]=>
string(1) "1"
[1]=>
string(7) "bla.jpg"
[2]=>
string(8) "nature
2"
[3]=>
string(0) ""
[4]=>
string(5) "earth"
}
}
- Output for 4.4.2 - 4.4.9
- Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/9FdVQ on line 8
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
- Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/9FdVQ on line 8
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/9FdVQ on line 8
Process exited with code 255.
preferences:
89.49 ms | 413 KiB | 5 Q