3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // $output = array_slice(array_merge(explode(' | ', $input), array(null)), 0, 2); $output = array_slice(explode(" | ", "$input | "), 0, 2); $input = 'one'; print_r($output); $input = 'one | two'; print_r($output); $input = 'one | two | three'; print_r($output); $input = 'one | two | three | '; print_r($output);
Output for 5.0.4 - 7.1.0
Notice: Undefined variable: input in /in/TTFn6 on line 6 Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => )
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: input in /in/TTFn6 on line 6 Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => )