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 gZbIX
Output for 4.3.3 - 7.1.0
Success!
Output for 4.3.2
Fatal error: [] operator not supported for strings in /in/Ys9hH 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/Ys9hH on line 7