Hi I have a string path
/opt/sites/test.site/map1/map2/folder/test2/test.doc
How can I remove the test2/test.doc so the string will become
/opt/sites/test.site/map1/map2/folder/
Thanx
Hi I have a string path
/opt/sites/test.site/map1/map2/folder/test2/test.doc
How can I remove the test2/test.doc so the string will become
/opt/sites/test.site/map1/map2/folder/
Thanx
str_replace
explode
parse_url
regular expressions
depends if its always going to be the same text removed.
The first part has to stay always /opt/sites/test.site/map1/map2/folder/
rest has to be stript
If you always want to remove the file name and the lowest level directory name:
$file = '/opt/sites/test.site/map1/map2/folder/test2/test.doc';
$dir = dirname(dirname($file)) . '/';
echo $dir;