3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function test($arg){ $tmp = array(); if ($arg > 5) { $tmp[] = $arg; } var_dump($tmp); return "return" . $arg; } var_dump(array_map("test", range(1, 10)));
Output for 4.3.0 - 7.1.0
array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(1) { [0]=> int(6) } array(1) { [0]=> int(7) } array(1) { [0]=> int(8) } array(1) { [0]=> int(9) } array(1) { [0]=> int(10) } array(10) { [0]=> string(7) "return1" [1]=> string(7) "return2" [2]=> string(7) "return3" [3]=> string(7) "return4" [4]=> string(7) "return5" [5]=> string(7) "return6" [6]=> string(7) "return7" [7]=> string(7) "return8" [8]=> string(7) "return9" [9]=> string(8) "return10" }