3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( array('pear', 'apple'), array('banana', 'coconut'), 'orange' // This is not an array element ); foreach ($array as $value) { if (is_array($value)) { foreach ($value as $fruit) { echo $fruit . PHP_EOL; } } else { echo $value . PHP_EOL; } }
based on OtVbC
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
pear apple banana coconut orange
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/rMhPL on line 15 pearPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/rMhPL on line 15 applePHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/rMhPL on line 15 bananaPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/rMhPL on line 15 coconutPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/rMhPL on line 18 orangePHP_EOL