php - Replace (ss) with something else -
i have problem in php replacing (ss) in string.
$string = 'i want new (ss) now!'; $newstring = preg_replace('\(ss\)', 'car', $string); i expecting $newstring become:
i want new car now!
what doing wrong here ?
use str_replace
$string = 'i want new (ss) now!'; $newstring = str_replace('(ss)', 'car', $string); example http://codepad.org/2wcytl8e
output
i want new car now!
edit
example preg_replace
$string = 'i want new (ss) now!'; $newstring = preg_replace('$\(ss\)$', 'car', $string); output
i want new car now!
Comments
Post a Comment