|
Posted by One on 02/07/07 16:49
On Feb 7, 11:34 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> $number_percent is a string containing 25, not the numeric value 25.
> When you use a string in a calculation it's numeric value is zero.
>
> Try
> $number_percent=25;
>
> instead (and ensure that $history['order_total'] is also numeric).
Hi Jerry - thanks much for trying.
Same result :
Input :
$number_percent=25;
echo "history['order_total'] is ".$history['order_total']."<br />";
$removeit=str_replace('$' ,'', $history['order_total']);
echo "strip the $ sign ".$removeit."<br />";
$total = ($removeit * $number_percent);
echo "<br />total is ".$total."<br />";
Output :
history['order_total'] is $241.47
strip the $ sign 241.47
total is 0
This is bonkers - I'm *sure* I have done this type of thing in the
past without issue. :-(
Navigation:
[Reply to this message]
|