views:

84

answers:

2

hi, since eregi replace was deprecated on version 5.3 i want to make my program compatible with new version of php http://php.net/manual/en/function.eregi-replace.php

so, i'm trying to use preg_replace like this

preg_replace(",",'','20,000.00');

but come with error

i'm familiar with eregi_replace(',','','20,000.00'); i'm not familiar with regex expression. what is the best replacement for eregi_replace?

+2  A: 

preg_replace needs delimiters

$value = '20,000.00';    
$value = preg_replace("/,/",'',$value);    
echo $value;
Mark Baker
thank you :) it works..
apis17
A: 
str_replace(",",'','20,000.00');
Col. Shrapnel
this also works.. thanks.
apis17
@apis17 this is not "also" works. this is the difference between string functions and regular expressions you'd better understand.
Col. Shrapnel
is there any reference i could read about this?
apis17