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 206 views
2 answers 276 views
2 answers 257 views
257 views asked Jun 14, 2016 by avibootz
1 answer 273 views
2 answers 328 views
...