fork download
  1. <?php
  2.  
  3. class Czlowiek {
  4.  
  5. public static $liczbaUtworzonychLudzi = 0;
  6.  
  7. public $imie;
  8.  
  9. public function __construct(string $imie) {
  10. ++self::$liczbaUtworzonychLudzi;
  11.  
  12. $this->imie = $imie;
  13. }
  14.  
  15. }
  16.  
  17. $jan = new Czlowiek('Jan');
  18. $ania = new Czlowiek('Ania');
  19.  
  20. echo $jan->imie . PHP_EOL;
  21. echo $ania->imie . PHP_EOL;
  22. echo Czlowiek::$liczbaUtworzonychLudzi . PHP_EOL;
Success #stdin #stdout 0.02s 23820KB
stdin
Standard input is empty
stdout
Jan
Ania
2