3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function isStringOrNumeric($in) { return basename($in); } function test($a, $v) { var_dump($a); var_dump($v); } $a = array( 'index.php', '../../../index.php', 'valami.txt'); array_reduce($a, 'test'); /*$b = array_filter($a, 'isStringOrNumeric'); var_dump($a); var_dump($b);*/ if($b === $a) echo('Success!'); else echo('Fail!');
based on YFEjO
Output for 5.0.4 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
NULL string(9) "index.php" NULL string(18) "../../../index.php" NULL string(10) "valami.txt" Notice: Undefined variable: b in /in/L2h32 on line 17 Fail!
Output for 4.3.3 - 5.0.3
NULL string(9) "index.php" NULL string(18) "../../../index.php" NULL string(10) "valami.txt" Notice: Undefined variable: b in /in/L2h32 on line 17 Fail!
Output for 4.3.0 - 4.3.2
string(9) "index.php" string(18) "../../../index.php" NULL string(10) "valami.txt" Notice: Undefined variable: b in /in/L2h32 on line 17 Fail!