O'Reilly logo
  • miraj Desai thinks this is interesting:

To start, $url is assigned the value of http:// plus the host name (which could be either localhost or www.example.com). To this is added the name of the current directory using the dirname( ) function, in case the redirection is taking place within a subfolder. $_SERVER['PHP_SELF'] refers to the current script (which will be the one calling this function), including the directory name. That whole value might be /somedir/page.php. The dirname( ) function will return just the directory part from that value (i.e., /somedir...