3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function dotest($s) { $a = explode( ' ', $s, 2); var_dump($a); list($x,$y) = explode( ' ', $s, 2); echo "> '$x' , '$y' \n"; } dotest('test'); dotest('test and'); dotest('test and last');
Output for 5.3.0 - 5.6.21, 7.0.0 - 7.1.0
array(1) { [0]=> string(4) "test" } Notice: Undefined offset: 1 in /in/rrDQk on line 7 > 'test' , '' array(2) { [0]=> string(4) "test" [1]=> string(3) "and" } > 'test' , 'and' array(2) { [0]=> string(4) "test" [1]=> string(8) "and last" } > 'test' , 'and last'
Output for hhvm-3.10.0 - 3.12.0
array(1) { [0]=> string(4) "test" } Notice: Undefined index: 1 in /in/rrDQk on line 7 > 'test' , '' array(2) { [0]=> string(4) "test" [1]=> string(3) "and" } > 'test' , 'and' array(2) { [0]=> string(4) "test" [1]=> string(8) "and last" } > 'test' , 'and last'
Output for 4.3.0 - 5.2.17
array(1) { [0]=> string(4) "test" } Notice: Undefined offset: 1 in /in/rrDQk on line 7 > 'test' , '' array(2) { [0]=> string(4) "test" [1]=> string(3) "and" } > 'test' , 'and' array(2) { [0]=> string(4) "test" [1]=> string(8) "and last" } > 'test' , 'and last'