I'am having trouble with a preg_replace()
and I have tried to solve it for some time now.
I'am getting this error:
preg_replace: Delimiter must not be alphanumeric or backslash
Here is my code:
$id = 23;
$titleForUrl = "I_like_cookies";
$uploadShortDesc = "This is the best desc and I love it 1242";
$uploadShortDesc = preg_replace('\1242\',
'<a href="http:\/\/google.com\/freecookies\/'.$id.'-'.$titleForUrl.'">http:\/\/google.com\/freecookies\/'.$id.'-'.$titleForUrl.'.<\/a> ',
$uploadShortDesc);
echo $uploadShortDesc;
Is should echo:
This is the best desc and I love it <a href="http://google.com/freecookies/23- I_like_cookies">http://google.com/freecookies/23-I_like_cookies.</a>
I would love if someone could help me, I have put a \
in front of all /
but I don't know why it won't work.