07-20-2009, 11:13 AM
|
#3 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
You could also use a single call to preg_replace with multiple patterns/replacements.
PHP Code:
$subject = 'This is bullshit M$ Word. They make me 100% crazy.'; $search = array('/[^a-z0-9 ]+/i', '/ +/'); $replace = array('', '-'); echo preg_replace($search, $replace, $subject); // Output: This-is-bullshit-M-Word-They-make-me-100-crazy
|
|
|
|