<?php $strings = [ 'this/is/the/path/to/my/fileA.php', 'this/could/also/be/the/path/to/my/fileB.php', 'another/example/of/a/long/address/which/is/a/path/to/my/fileC.php', ]; foreach ($strings as $string) { echo implode('/', array_slice(explode('/', $string), -4)); echo "\n"; }
You have javascript disabled. You will not be able to edit any code.