<pre>
<?php

    
/*
     * Example 17: Objects and Classes
     * file: 17-objects.php
     */

    
class Dog {                              // define class
    
        
var $type;                           // add field
    
        
function Dog($type "Terrier") {    // constructor
            
$this->type $type;
        }
        
        function 
bark() {                    // method
            
echo "Woof!" "\r\n";
        }
    
    }
    
    
Dog::bark();            // static access
    
    
$bailey = new Dog();    // create new object
    
    
$bailey->bark();        // call method
    
echo $bailey->type;     // access field
    
?>