3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test($test) { $arr = array("-1"); if ($test) { $arr = array("1", "2", "1"); } return $arr; } print_r(test(true)); print_r(test(false)); $x = "bla - 0"; $x = str_replace("-", "-1", $x); $x = explode(" ", $x); print_r($x); $arr = array("-1"); if ($arr == array("-1")) { print("yes"); }
Output for 5.6.30, hhvm-3.15.4 - 3.22.0, 7.0.0 - 7.2.9
Array ( [0] => 1 [1] => 2 [2] => 1 ) Array ( [0] => -1 ) Array ( [0] => bla [1] => -1 [2] => 0 ) yes