note 76347 added to reserved.variables

From: Date: Wed, 11 Jul 2007 14:19:18 +0000
Subject: note 76347 added to reserved.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-128384@lists.php.net to get a copy of this message
More attractive way for displaying a URL <?php function get_url($show_port = false) { if($_SERVER['HTTPS']) { $my_url = 'https://'; } else { $my_url = 'http://'; } $my_url .= $_SERVER['HTTP_HOST']; if($show_port) { $my_url .= ':' . $_SERVER['SERVER_PORT']; } $my_url .= $_SERVER['SCRIPT_NAME']; if($_SERVER['QUERY_STRING'] != null) { $my_url .= '?' . $_SERVER['QUERY_STRING']; } return $my_url; } echo get_url(); // Outputs: http://localhost/ echo get_url(true); // Outputs: http://localhost:80/ ?> ---- Server IP: 194.145.210.3 Probable Submitter: 82.47.83.146 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.php Edit -- https://master.php.net/note/edit/76347 Del: integrated -- https://master.php.net/note/delete/76347/integrated Del: useless -- https://master.php.net/note/delete/76347/useless Del: bad code -- https://master.php.net/note/delete/76347/bad+code Del: spam -- https://master.php.net/note/delete/76347/spam Del: non-english -- https://master.php.net/note/delete/76347/non-english Del: in docs -- https://master.php.net/note/delete/76347/in+docs Del: other reasons-- https://master.php.net/note/delete/76347 Reject -- https://master.php.net/note/reject/76347 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128384) next »