note 70133 added to function.preg-replace
| From: | wjaspers | Date: | Wed, 04 Oct 2006 16:42:24 +0000 |
| Subject: | note 70133 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118034@lists.php.net to get a copy of this message | ||
If you need to remove excess slashes from links (or convert incorrect ones), you may want to use
this function:
<?php
/**
* Replaces excess / slashes, and converts \ slashes into /
*
* Author: William Jaspers, wjapers[at]nuaire[dot]com
* Created: 04 Oct 2006 11:38 AM
* @param string $input // The string to strip and replace slashes in
* @returns string
*/
function fixSlashes($input)
{
return preg_replace('/(\/|\\\)++/','/',$input);
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 209.150.201.146 (proxied: 1.0 FIREWALL1)
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/70133
Del: integrated -- https://master.php.net/note/delete/70133/integrated
Del: useless -- https://master.php.net/note/delete/70133/useless
Del: bad code -- https://master.php.net/note/delete/70133/bad+code
Del: spam -- https://master.php.net/note/delete/70133/spam
Del: non-english -- https://master.php.net/note/delete/70133/non-english
Del: in docs -- https://master.php.net/note/delete/70133/in+docs
Del: other reasons-- https://master.php.net/note/delete/70133
Reject -- https://master.php.net/note/reject/70133
Search -- https://master.php.net/manage/user-notes.php