Convert string to integer and multiply two integers
Posted
by
demlasjr
on Stack Overflow
See other posts from Stack Overflow
or by demlasjr
Published on 2012-09-25T09:36:29Z
Indexed on
2012/09/25
9:37 UTC
Read the original article
Hit count: 291
I have a big time trying to either convert a string into a integer or multiply two integers. I can't convert the string into integer because it's resulting me into a boolean (when I'm using var_dump). I can convert the other integer in string, but I'm unable to multiply it.
I have this:
<? $fees=$commerce->cart->get_total();
$payfee = str_replace(' €', '', $fees);
$payfee = str_replace(',','', $payfee); //this is the string
$fee = 0.025;
$paypal = $payfee * $fee; //this thing is not working
?>
I tried converting the payfee in integer, but still can't make it work. I did something like this before and worked well, but not this time.
Any help will be appreciated.
P.S Thank you to the whole stackoverflow.com community which helped me many times before.
© Stack Overflow or respective owner