note 89751 added to function.trim

From: Date: Sat, 21 Mar 2009 11:48:41 +0000
Subject: note 89751 added to function.trim
Groups: php.notes 
Request: Send a blank email to php-notes+get-152254@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/89751 Del: integrated -- https://master.php.net/note/delete/89751/integrated Del: useless -- https://master.php.net/note/delete/89751/useless Del: bad code -- https://master.php.net/note/delete/89751/bad+code Del: spam -- https://master.php.net/note/delete/89751/spam Del: non-english -- https://master.php.net/note/delete/89751/non-english Del: in docs -- https://master.php.net/note/delete/89751/in+docs Del: other reasons-- https://master.php.net/note/delete/89751 Reject -- https://master.php.net/note/reject/89751 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152254) next »