jcbodyworks
asked on
Ereg_replace
I have a question in reference to the ereg_replace function in PHP. How exactly do you make it work and how does the syntax work? I find tons of code for this function, but I do not understand how to organize the brackets of items you want to replace. I have this simple ereg_replace function on my site that removes the $ and % and , for a blank space.
$loanamount=ereg_replace(" [$%,]","", $_POST['lo anamount'] );
Thanks. Maybe a little tutorial on this function will do.
$loanamount=ereg_replace("
Thanks. Maybe a little tutorial on this function will do.
ereg_replace gets three arguments, all of them separated by the commas. The first argument is the string to be replaced, the second argument is what will replace the string given on the first argument and the third argument is where it will search for it.
So, ereg_replace("something"," SOMETHINGD IFFERENT", "this string shows something"); will output "this string shows SOMETHINGDIFFERENT.
The brackets used there state that ANY $, % or , will be replaced by "" (a blank space)
More information here: http://www.php.net/ereg_replace
-V
So, ereg_replace("something","
The brackets used there state that ANY $, % or , will be replaced by "" (a blank space)
More information here: http://www.php.net/ereg_replace
-V
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
something like this then:
<?php
$test = "\$mydkjsi % this";
$loanamount=ereg_replace("
echo $loanamount;
?>