What is the difference between $_SERVER['QUERY_STRING'] and $_SERVER['PHP_SELF'] in PHP?

$_SERVER['QUERY_STRING'] contains the query string part of the URL, including any parameters passed to the script. On the other hand, $_SERVER['PHP_SELF'] contains the filename of the currently executing script. If you want to get the full URL of the current page, you can concatenate $_SERVER['PHP_SELF'] and $_SERVER['QUERY_STRING'].

$url = "http://$_SERVER[HTTP_HOST]$_SERVER[PHP_SELF]?$_SERVER[QUERY_STRING]";
echo $url;