How to get the upper folder (parent directory) from the current folder in PHP

2 Answers

0 votes
echo dirname(__DIR__);


/*
run:

/home/website/public_html/abc

*/

 



answered Dec 17, 2018 by avibootz
0 votes
echo dirname($url);


/*
run:

https://www.allonpage.com/abc

*/

 



answered Dec 17, 2018 by avibootz

Related questions

1 answer 288 views
2 answers 249 views
249 views asked Jun 14, 2016 by avibootz
1 answer 229 views
229 views asked Aug 2, 2018 by avibootz
1 answer 212 views
212 views asked Aug 25, 2015 by avibootz
3 answers 419 views
1 answer 119 views
119 views asked Aug 6, 2023 by avibootz
...