return $this->passKey; } public function getPassKey() { return 'foo'; } } // create an instance of the Car class $myCar = new Car('Mercedes', '760EL', 'black'); output(Car::$instanceCount); // public properties are externally accessible //$myCar->color = 'red'; echo '<p>' . $myCar->color . '</p>'; //$myCar->status = 'on'; // generates an access fatal error_get_last echo $myCar->startEngine(); // works $yourCar = new SUV('Ford', 'Escalade', 'green'); echo '<p>' . $yourCar->model . '</p>'; echo '<p>' . $yourCar->has4WD . '</p>'; $f = 'startEngine'; output($yourCar->{$f}()); echo '<p>' . $yourCar->startEngine() . '</p>'; echo '<p>' . $myCar->getPassKey() . '</p>'; echo '<p>' . $yourCar->getPassKey() . '</p>'; echo '<p>' . $yourCar->getStatus() . '</p>'; echo '<p>' . $yourCar->getKey() . '</p>'; output(Car::$instanceCount); unset($myCar); // destroy object, calling destructor in the process $c = 'Car'; output($c::$instanceCount);