Class Definition
<?php
  
class Cart {
    var 
$items;
    function 
add_item($artnr$num) {
        
$this->items[$artnr] += $num;
    }  
  } 
?>
Inheriting a class with a Constructor
<?php
  
class NamedCart extends Cart {
    var 
$owner;
    function 
NamedCart($name) {
        
$this->owner $name;
    }
  } 
?>