I am having the following statements.
$formula=((( 5339) * ( 1 + Cess Duty + 0.14 * ( 1 + 0.02 + 0.01) + Packing & Forwarding) + Packing & Forwarding fixed));
$formula=str_replace($chk_row[tax_name],0,$formula);
Where $chk_row[tax_name] value is coming from database i.e. red marked value in above formula.
But in query "Packing & Forwarding" is coming before "Packing & Forwarding fixed". so in replace function both "Packing & Forwarding" gets replaced and only "0 fixed" remains in formula which results in error while evaluating formula.
Kindly suggest replace this value usnig regular expression.
Anybody can help me.....
Thanks in advance
Sandeep
str_replace problem
Moderator: General Moderators
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: str_replace problem
What are you actually trying to do? Use [ php ] and [ /php ] tags to illustrate your script better. I doubt you're going to need str_replace().