How to get the directory name from a path with dirname() function in PHP

2 Answers

0 votes
echo dirname("e:/test/temp.txt");
    
/*
run:

e:/test

*/

 



answered Dec 8, 2015 by avibootz
0 votes
$path = "c:/xampp/htdocs/knowrex.com/index.php";
$dir = dirname($path);
    
echo "dirname: $dir<br />";
 
/*
run:
 
dirname: c:/xampp/htdocs/knowrex.com
  
*/

 



answered Apr 17, 2016 by avibootz

Related questions

1 answer 259 views
1 answer 217 views
2 answers 197 views
1 answer 177 views
1 answer 179 views
1 answer 197 views
2 answers 268 views
...