note 70133 deleted from function.preg-replace by colder
| From: | colder@php.net | Date: | Mon, 18 Jun 2007 20:04:13 +0000 |
| Subject: | note 70133 deleted from function.preg-replace by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127706@lists.php.net to get a copy of this message | ||
Note Submitter: wjaspers [at] nuaire [dot] com
----
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);
}
?>