PDA

View Full Version : preg_replace problem


sabret00the
05-24-2005, 02:00 PM
i'm getting a "Delmiter must not be alpha numeric or a backslash on this line
$findme = 'images/smilies';
$pos = strpos($post[usertitle], $findme);
if ($pos == TRUE)
{
preg_replace('img src="', 'img src="$vboptions[bburl]/', "$post[usertitle]");
}

what am i doing wrong?

Zero Tolerance
05-24-2005, 02:52 PM
You really don't need preg_replace(), it uses more resources, you could do it easily with str_replace:
$post[usertitle] = str_replace('img src="', 'img src="$vboptions[bburl]/', $post[usertitle]);

:)

- Zero Tolerance

sabret00the
05-24-2005, 03:22 PM
ah ok, nice one, that fixed it, though i needed to ' . $vbulletion[bburl] . ' :)

Zero Tolerance
05-25-2005, 11:28 AM
ah ok, nice one, that fixed it, though i needed to ' . $vbulletion[bburl] . ' :)
Yeah using single quotes for a string stops php from parsing it out, which is good if you don't want it parsing out, so if you use plain text for a lot of variables, good to use single quotes, it won't make much of a resource difference, but every little helps :)

- Zero Tolerance