private $width; private $height; public function __construct($width, $height) { $this->width = $width; $this->height = $height; } public function calcArea() { return $this->width * $this->height; } } $circ = new Circle(3); $rect = new Rectangle(3, 4); // <?= is the shortcut for <?php echo ?> <?php echo $circ->calcArea(); ?> <br/> <?php echo $rect->calcArea(); ?>