How to get the last directory in path with PHP

1 Answer

0 votes
// string strrchr(string $haystack, mixed $needle)

$path = "c:\\xampp\\htdocs\\workingframe.com\\bootstrap-3.3.6-dist";

echo strrchr($path, "\\") . "<br />";
echo substr(strrchr($path, "\\"), 1);



/*
run:
    
\bootstrap-3.3.6-dist
bootstrap-3.3.6-dist 
    
*/

 



answered Jul 20, 2016 by avibootz

Related questions

1 answer 198 views
2 answers 269 views
2 answers 247 views
247 views asked Jun 14, 2016 by avibootz
1 answer 259 views
2 answers 318 views
...