note 93829 added to function.strrpos

From: Date: Thu, 01 Oct 2009 20:24:30 +0000
Subject: note 93829 added to function.strrpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-161210@lists.php.net to get a copy of this message
If you're trying to do what "Alexandre" did a few posts below this one, that is, removing trailing slashes, just use rtrim() for simple stuff, and a preg function for more complicated removals. Either one of the following functions will remove a trailing slash unless it's a root folder. <?php function trimTrailingSlashes1( $str ) { // It's always a good idea to do this just to make sure. $str = trim($str); // If it's root, don't rtrim() the only slash away. // Passing a character mask to rtrim makes it look for the // characters you specify. return $str == '/' ? $str : rtrim($str, '/'); } ?> ---- Server IP: 209.41.74.194 Probable Submitter: 70.182.68.137 ---- Manual Page -- http://www.php.net/manual/en/function.strrpos.php Edit -- https://master.php.net/note/edit/93829 Del: integrated -- https://master.php.net/note/delete/93829/integrated Del: useless -- https://master.php.net/note/delete/93829/useless Del: bad code -- https://master.php.net/note/delete/93829/bad+code Del: spam -- https://master.php.net/note/delete/93829/spam Del: non-english -- https://master.php.net/note/delete/93829/non-english Del: in docs -- https://master.php.net/note/delete/93829/in+docs Del: other reasons-- https://master.php.net/note/delete/93829 Reject -- https://master.php.net/note/reject/93829 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#161210) next »