<?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', ]; var_export( preg_replace( '~(?:/[^/]*){4}$~', '', $strings ) );
You have javascript disabled. You will not be able to edit any code.