...

View Full Version : PHP Arithmetic



CoonOnParol
11-25-2011, 04:44 AM
When I use:

$grandtotal = ($_SESSION['value'] + $_SESSION['cost'] * 100);
or

$grandtotal = $_SESSION['value'] + $_SESSION['cost'] * 100;
I get 122.50

Why doesn't it give me 12250?

Adee
11-25-2011, 05:01 AM
Order of operations.. plus the values contained in your session variables might be wrong.

$grandtotal = ($_SESSION['value'] + $_SESSION['cost']) * 100;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum