nlopess         Wed Dec  8 06:59:36 2004 EDT

  Modified files:              
    /phpdoc/en/language oop.xml 
  Log:
  fix #31008: first example had a little bug
  
http://cvs.php.net/diff.php/phpdoc/en/language/oop.xml?r1=1.55&r2=1.56&ty=u
Index: phpdoc/en/language/oop.xml
diff -u phpdoc/en/language/oop.xml:1.55 phpdoc/en/language/oop.xml:1.56
--- phpdoc/en/language/oop.xml:1.55     Tue Dec  7 14:28:42 2004
+++ phpdoc/en/language/oop.xml  Wed Dec  8 06:59:35 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.55 $ -->
+<!-- $Revision: 1.56 $ -->
  <chapter id="language.oop">
   <title>Classes and Objects (PHP 4)</title>
 
@@ -16,22 +16,25 @@
 <?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;
+        } elseif ($this->items[$artnr] == $num) {
+            unset($this->items[$artnr]);
+            return true;
         } else {
             return false;
-        }   
+        }
     }
 }
 ?>

Reply via email to