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 279 views
2 answers 233 views
233 views asked Jun 14, 2016 by avibootz
1 answer 204 views
204 views asked Aug 2, 2018 by avibootz
1 answer 203 views
203 views asked Aug 25, 2015 by avibootz
3 answers 388 views
1 answer 108 views
108 views asked Aug 6, 2023 by avibootz
...