Page 1 of 1

error in preg_replace

Posted: Wed May 27, 2009 5:13 am
by crishna369
My Code is :

Code: Select all

$cod = 4;
$temp = preg_replace($cod, '', $tp, 1);
Error is :
Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in /home/kthakkar/public_html/crm/insert.php on line 245

Re: error in preg_replace

Posted: Wed May 27, 2009 8:10 am
by ramya123
Pattern matching String should always be enclosed with delimiters. You are missing delimiters.
for example: preg_replace("/hi/", "hello", "hi test");
In this example / is the delimiter.