April 26, 2006

PHP variable cleanup...

Needed some quick code to remove some characters from a URL field and replace them with underscores.


Found a short discussion on WebMasterWord that contained this code:


$old_pattern = array("/[^a-zA-Z0-9]/", "/_+/", "/_$/");
$new_pattern = array("_", "_", "");
$file_name = strtolower(preg_replace($old_pattern, $new_pattern , $text_title));

Posted by TheIdeaMan at April 26, 2006 11:29 AM | TrackBack
Comments
Post a comment









Remember personal info?