3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = './CatDV/S1/SFX/steam/6004_90_04 LargeHeadlightSm.wav ./CatDV/S1/SFX/steam/AirHissPressureRe HIT032001.wav ./CatDV/S1/SFX/steam/Impact_Metal_Bullet_Hit(1).wav ./CatDV/S1/SFX/steam/Impact_Metal_Bullet_Hit.wav ./CatDV/S1/SFX/steam/6004_94_02 LargeHeavyGlassS.wav ./CatDV/S1/SFX/steam/Impact_Glass_Smash.wav ./CatDV/S1/SFX/steam/AirReleaseHeavyAi HIT030701.wav ./CatDV/S1/SFX/steam/SDR02_15SCIF RhythmicRever.wav ./CatDV/S1/SFX/steam/VAL02_08CRSH GlassBreaking.wav ./CatDV/S1/SFX/steam/AirReleaseLargeAi HIT030601.wav ./CatDV/S1/SFX/steam/SDR02_14SCIF Rhythmic3Beat.wav ./CatDV/S1/SFX/steam/6004_94_01 LargeGlassSmash.wav'; var_dump(createTree($file)); function splitIntoPaths($string) { $paths = array(); foreach (explode("\n", $string) as $line) { $node = &$paths; foreach (explode("/", $line) as $segment) { if (!isset($node[$segment])) { $node[$segment] = array(); } $node = &$node[$segment]; } $node = $line; } return $paths; } function createTree($string) { $paths = splitIntoPaths($string); $cb = function($array) use (&$cb) { $return = '<ul>'; foreach ($array as $key => $value) { $return .= '<li>' . $key; if (is_array($value)) { $return .= $cb($value); } $return .= '</li>'; } $return .= '</ul>'; return $return; } return $cb($paths); }
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'return' (T_RETURN) in /in/s9kR8 on line 47
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_RETURN in /in/s9kR8 on line 47
Process exited with code 255.

preferences:
175.98 ms | 1395 KiB | 65 Q