echo $_SERVER['REQUEST_URI'];
This will print the current URL path in your website but not the base URL or your domain name for the server. To print the base URL or domain use
echo $_SERVER['SERVER_NAME']
Things for everyday needs
echo $_SERVER['REQUEST_URI'];
This will print the current URL path in your website but not the base URL or your domain name for the server. To print the base URL or domain use
echo $_SERVER['SERVER_NAME']