note 109483 added to function.rtrim

From: Date: Fri, 20 Jul 2012 19:49:36 +0000
Subject: note 109483 added to function.rtrim
Groups: php.notes 
Request: Send a blank email to php-notes+get-189342@lists.php.net to get a copy of this message
Function similar to rtrim only this will truncate the string at the 1st occurence of any character from $charlist <?php function rstrip($string, $charlist = "\t ") { // removes everything from first occurence of char in charlist to end of string $charlist = str_split($charlist); $pos = strlen($string); foreach ($charlist as $char) { $pos = min(strpos($string, $char), $pos); } $string_stripped = substr($string, 0, $pos); return $string_stripped; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 24.89.139.58 ---- Manual Page -- http://www.php.net/manual/en/function.rtrim.php Edit -- https://master.php.net/note/edit/109483 Del: integrated -- https://master.php.net/note/delete/109483/integrated Del: useless -- https://master.php.net/note/delete/109483/useless Del: bad code -- https://master.php.net/note/delete/109483/bad+code Del: spam -- https://master.php.net/note/delete/109483/spam Del: non-english -- https://master.php.net/note/delete/109483/non-english Del: in docs -- https://master.php.net/note/delete/109483/in+docs Del: other reasons-- https://master.php.net/note/delete/109483 Reject -- https://master.php.net/note/reject/109483 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189342) next »