3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $files=array("index.md","storage_index.md","storage_one.md"); $master_array=array(); foreach($files as $file) { $file=explode("_",$file); $cache=end($file); while($level=prev($file)) { $cache=array($level=>$cache); } $master_array=array_merge_recursive($master_array,$cache); } print_r($master_array);
Output for 5.0.0 - 7.2.0
Warning: array_merge_recursive(): Argument #2 is not an array in /in/WvqCK on line 12 Warning: array_merge_recursive(): Argument #1 is not an array in /in/WvqCK on line 12 Warning: array_merge_recursive(): Argument #1 is not an array in /in/WvqCK on line 12
Output for 4.3.0 - 4.4.9
Array ( [0] => index.md [storage] => Array ( [0] => index.md [1] => one.md ) )