3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function isStringOrNumeric($in) { return basename($in); } function test($carry, $value) { $carry[] = basename($value); return $carry; } $a = array( 'index.php', '../../../index.php', 'valami.txt'); $b = array_reduce($a, 'test'); if($b === $a) echo('Success!'); else echo('Fail!');
based on HLE71
Output for 4.3.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Fail!
Output for 4.3.2
Fatal error: [] operator not supported for strings in /in/gZbIX on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: [] operator not supported for strings in /in/gZbIX on line 7