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 239 views
1 answer 201 views
2 answers 181 views
1 answer 167 views
1 answer 166 views
1 answer 190 views
2 answers 252 views
...