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 367 views
2 answers 364 views
364 views asked Jun 14, 2016 by avibootz
1 answer 310 views
310 views asked Aug 2, 2018 by avibootz
1 answer 315 views
315 views asked Aug 25, 2015 by avibootz
3 answers 582 views
1 answer 212 views
212 views asked Aug 6, 2023 by avibootz
...