I need some help combining PHP string manipulation functions in order to take a path:
./Test/Path/123/456/
and taking away the last folder part so it looks like this:
./Test/Path/123/
Maybe its just that I'm tired and have been working on this the whole day but nothing will work.
All I managed to do was turn the path into .TestPath123 which won't work at all for what I need.
Using PHP String functions
Moderator: General Moderators
Re: Using PHP String functions
There's a function for that. Doesn't keep the trailing slash in case you really want that.
Re: Using PHP String functions
Code: Select all
$a='./Test/Path/123/456/';
echo $a.'<br />';
$a = substr($a,0,strrpos($a,'/',-1));
$a = substr($a,0,(strrpos($a,'/',0)+1));
echo $a.'<br />';
Re: Using PHP String functions
tasairis, thank you... I can easily add a / ---- .'/'
I just can't believe that I spent 3 hours trying to figure out how to do the same thing.
I just can't believe that I spent 3 hours trying to figure out how to do the same thing.
Re: Using PHP String functions
I used the code in my directory listing script http://aband0ned.net/
Any comments / questions / suggestions can go to socket1@aband0ned.net
Any ideas to prevent http://aband0ned.net/?dir=../ that ?
Any comments / questions / suggestions can go to socket1@aband0ned.net
Any ideas to prevent http://aband0ned.net/?dir=../ that ?