ID: 31008
Updated by: [EMAIL PROTECTED]
Reported By: afjoijojifaj9foobar dot 5 dot rdancer at spamgourme
Status: Open
-Bug Type: Website problem
+Bug Type: Documentation problem
PHP Version: Irrelevant
New Comment:
Docproblem.
Previous Comments:
------------------------------------------------------------------------
[2004-12-07 12:35:50] afjoijojifaj9foobar dot 5 dot rdancer at
spamgourme
Description:
------------
The test in the remove_item() function should be
if ($this->items[$artnr] >= $num)
^^
Cheers,
Jan Min�ř
"http://uk2.php.net/manual/en/language.oop5.php":
<?php
class Cart {
var $items; // Items in our shopping cart
// Add $num articles of $artnr to the cart
function add_item($artnr, $num) {
$this->items[$artnr] += $num;
}
// Take $num articles of $artnr out of the cart
function remove_item($artnr, $num) {
if ($this->items[$artnr] > $num) {
$this->items[$artnr] -= $num;
return true;
} else {
return false;
}
}
}
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31008&edit=1