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 286 views
2 answers 246 views
246 views asked Jun 14, 2016 by avibootz
1 answer 224 views
224 views asked Aug 2, 2018 by avibootz
1 answer 210 views
210 views asked Aug 25, 2015 by avibootz
3 answers 410 views
1 answer 115 views
115 views asked Aug 6, 2023 by avibootz
...