note 89750 added to function.trim

From: Date: Sat, 21 Mar 2009 11:48:16 +0000
Subject: note 89750 added to function.trim
Groups: php.notes 
Request: Send a blank email to php-notes+get-152253@lists.php.net to get a copy of this message
small fix for the trimString function to proof against slash and backslash: function trimString($input, $string){ $input = trim($input); $string = str_replace("\\", "\\\\", $string); $string = str_replace('/', '\\/', $string); $startPattern = "/^($string)+/i"; $endPattern = "/($string)+$/i"; return trim(preg_replace($endPattern, '', preg_replace($startPattern,'',$input))); } ---- Server IP: 69.147.83.197 Probable Submitter: 89.101.26.141 ---- Manual Page -- http://www.php.net/manual/en/function.trim.php Edit -- https://master.php.net/note/edit/89750 Del: integrated -- https://master.php.net/note/delete/89750/integrated Del: useless -- https://master.php.net/note/delete/89750/useless Del: bad code -- https://master.php.net/note/delete/89750/bad+code Del: spam -- https://master.php.net/note/delete/89750/spam Del: non-english -- https://master.php.net/note/delete/89750/non-english Del: in docs -- https://master.php.net/note/delete/89750/in+docs Del: other reasons-- https://master.php.net/note/delete/89750 Reject -- https://master.php.net/note/reject/89750 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152253) next »