3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $in = array( "Hello", "Hello | world", "Hello | My | Lovely | World" ); foreach($in as $test){ list($one,$two) = explode(" | ", $test, 2); print_r(array($one, $two)); } foreach($in as $test){ list($one,$two) = explode(" | ", $test); print_r(array($one, $two)); }
Output for 5.3.0 - 7.2.0
Notice: Undefined offset: 1 in /in/JcSPp on line 10 Array ( [0] => Hello [1] => ) Array ( [0] => Hello [1] => world ) Array ( [0] => Hello [1] => My | Lovely | World ) Notice: Undefined offset: 1 in /in/JcSPp on line 15 Array ( [0] => Hello [1] => ) Array ( [0] => Hello [1] => world ) Array ( [0] => Hello [1] => My )
Output for 4.3.0 - 5.2.17
Notice: Undefined offset: 1 in /in/JcSPp on line 10 Array ( [0] => Hello [1] => ) Array ( [0] => Hello [1] => world ) Array ( [0] => Hello [1] => My | Lovely | World ) Notice: Undefined offset: 1 in /in/JcSPp on line 15 Array ( [0] => Hello [1] => ) Array ( [0] => Hello [1] => world ) Array ( [0] => Hello [1] => My )