[thelist] [PHP] PHP5 and the use of += ?

Tris beertastic at gmail.com
Tue Aug 19 04:40:20 CDT 2008


Hi all...
I'm currently moving a shopping basket from a PHP 4 server to a PHP 5
serrver and it's 90% ok.
However,
The shopping basket system, currently loops through the items in the
users basket and keeps a tally of the total cost using this:

$finalPrice += $itemPrice;

In each loop of the basket checker..

However, in the new server, it seems to be adding up more than it needs to.
As if it's doing for each loop:

$finalPrice = $finalPrice + $finalPrice + $itemPrice;
So the more goes into the basket, the more out ther final price is..

I'm heartily confused...
Does += work as it should in PHP5???

Tris...


-- 
"The only people who don't make mistakes are those who don't do anything"

Give a man a fish and he'll feed himself for a day.
Give a man a religion and he'll starve to death praying for a fish.
Anon

`We are what we pretend to be, so we must be careful what we pretend to be.`
Kurt Vonnegut

`When a person can no longer laugh at himself, it is time for others
to laugh at him.`
Thomas Szasz



More information about the thelist mailing list