3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $data = ['a',['b','c','d'],['e',['f','g']]]; // only covers the first row foreach(new RecursiveArrayIterator($data) as $item) { echo $item . "\n"; } // recursively finds all items foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($data)) as $item) { echo $item . "\n"; }
based on OTdbA
Output for 5.4.11 - 7.2.0
a Notice: Array to string conversion in /in/WvoSG on line 7 Array Notice: Array to string conversion in /in/WvoSG on line 7 Array a b c d e f g
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/WvoSG on line 3
Process exited with code 255.