<?php $string = 'var/log/some/other/directory/file.log'; $array = explode('/', $string); for ($c = count($array); $c > 0; ) { $output[--$c] = implode('/', $array); array_pop($array); } for ($i = 0; $i < count($output); $i++) { echo "$output[$i]\n"; }
You have javascript disabled. You will not be able to edit any code.