How to get full URL without filename in PHP

Learn PHP

One of my project needs to get the full URL since it was in a folder, I can’t use the $_SERVER[‘REQUEST_URI’] because it also shows the filename like index.php

So I stumble upon this code that will help us gets the exact folder where the file is use.


Hope this helps everyone.