PHP und OOP: Teil 3, Statische Inhalte
class Egret { protected $size; // cm protected static $counter = 0; public function __construct() { $this->size = rand(27, 230); self::$counter++; } public function __destruct() { echo 'Krawg! Kraahg!! *I am dying!*' . PHP_EOL; self::$counter--; } public function getSize() { return $this->size; } public static function getCount() { return self::$counter; } }