note 53884 added to function.substr

From: Date: Thu, 16 Jun 2005 05:04:04 +0000
Subject: note 53884 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-90501@lists.php.net to get a copy of this message
A really simple script to shorten the web site's address (http://something.com/file.php -> http://something.com/) in case you need to know where you are without showing the .php file. <?php $path = "http://" . $_SERVER['HTTP_HOST'] . $HTTP_SERVER_VARS["SCRIPT_NAME"]; $path_php = path; //shorten until '/' while (substr ($path, -1) != '/'){ $path = substr( $path, 0, -1); } /* to see the difference: */ echo $path_php."<br>"; echo $path; ?> ---- Manual Page -- http://www.php.net/manual/en/function.substr.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53884 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53884&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53884&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53884&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53884&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53884&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53884&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53884&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90501) next »