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;
    }
  } 
?>
Invocation
<?php
  $cart = new NamedCart("PenguinGear");
  $cart->add_item(170923, 2);
?>
Static Method calls
<?php
  class foo {
    function bar() {
        echo "bar() called";
    }
  }

  foo::bar();
?>
Output