3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $tests = array( 'test1', 't1;t2;t3', '', null, ); foreach ( $tests as $i => $str ) { var_dump(array_shift(explode(';',$str))); }
Output for 7.0.0 - 7.1.0
Notice: Only variables should be passed by reference in /in/NtkbK on line 10 string(5) "test1" Notice: Only variables should be passed by reference in /in/NtkbK on line 10 string(2) "t1" Notice: Only variables should be passed by reference in /in/NtkbK on line 10 string(0) "" Notice: Only variables should be passed by reference in /in/NtkbK on line 10 string(0) ""
Output for hhvm-3.12.0 - 3.13.2
string(5) "test1" string(2) "t1" string(0) "" Warning: explode() expects parameter 2 to be string, null given in /in/NtkbK on line 10 Warning: array_shift() expects parameter 1 to be an array or mutable collection in /in/NtkbK on line 10 NULL
Output for 4.3.0 - 5.0.4, hhvm-3.10.0
string(5) "test1" string(2) "t1" string(0) "" string(0) ""
Output for 5.1.0 - 5.6.28
Strict Standards: Only variables should be passed by reference in /in/NtkbK on line 10 string(5) "test1" Strict Standards: Only variables should be passed by reference in /in/NtkbK on line 10 string(2) "t1" Strict Standards: Only variables should be passed by reference in /in/NtkbK on line 10 string(0) "" Strict Standards: Only variables should be passed by reference in /in/NtkbK on line 10 string(0) ""
Output for 5.0.5
Fatal error: Only variables can be passed by reference in /in/NtkbK on line 10
Process exited with code 255.