3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function sum($carry, $item) { echo $carry."==".$item.PHP_EOL; $carry += $item; return $carry; } $a = array(1, 2, 3, 4, 5); var_dump(array_reduce($a, "sum"));
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
==1 1==2 3==3 6==4 10==5 int(15)
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.3 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/TvAv4 on line 4 ==1PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/TvAv4 on line 4 1==2PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/TvAv4 on line 4 3==3PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/TvAv4 on line 4 6==4PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/TvAv4 on line 4 10==5PHP_EOLint(15)
Output for 4.3.0 - 4.3.2
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/TvAv4 on line 4 1==2PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/TvAv4 on line 4 3==3PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/TvAv4 on line 4 6==4PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/TvAv4 on line 4 10==5PHP_EOLint(15)