|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-12-07 16:17 UTC] goba@php.net
[2004-12-07 21:40 UTC] nlopess@php.net
[2004-12-07 22:59 UTC] philip@php.net
[2004-12-08 13:00 UTC] nlopess@php.net
[2020-02-07 06:11 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 11:00:01 2025 UTC |
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; } } } ?>