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) { // Check type of element... if (is_array($value)) { foreach ($value as $fruit) { echo $fruit . PHP_EOL; } } else { echo $value . PHP_EOL; } }
based on rMhPL
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
pear apple banana coconut orange
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/8qFuC on line 14 pearPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/8qFuC on line 14 applePHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/8qFuC on line 14 bananaPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/8qFuC on line 14 coconutPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/8qFuC on line 17 orangePHP_EOL