3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Animal { protected $what = "nothing"; protected $born; function sound() { echo get_class($this)." says {$this->what}"; } public function __construct() { $this->born = time(); } } class Cow extends Animal { protected $what = "moo"; protected $owner; public function __construct($owner) { $this->owner = $owner; // parent::__construct(); (?) } } $a = new Cow("Old McDonald"); $a->sound();

preferences:
34.64 ms | 402 KiB | 5 Q