3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function show($arr, $prefix = '') { if (!is_array($arr)) { if ($prefix) { echo $prefix . '->'. $arr, "\n"; } else { echo $arr, "\n"; } } else { foreach ($arr as $key => $val) { $pre = $prefix; if (is_array($val)) { if ($pre) { $pre = $pre . '->' . $key; } else { $pre = $key; } show($val, $pre); } else { show($val, $pre); } } } } $list = array( 'transport' => array( 'plane' => array( 'boeing', 'airbus', ), 'car' => array( 'audi', 'ford' ), ), ); show($list);
Output for 4.3.0 - 7.1.0
transport->plane->boeing transport->plane->airbus transport->car->audi transport->car->ford