3v4l.org

run code in 300+ PHP versions simultaneously
<?php Class Employee { public string $name; public int $age; public function __construct(string $n, int $a) { $this->name = $n; $this->age = $a; } public function getThis() { return $this; } public function getFullInfo() { return 'Меня зовут ' . $this->name . '. Мне ' . $this->age . ' года.' . PHP_EOL; } } $petr = new Employee('Петр', 23); $valera = new Employee('Валера', 54); print_r($petr->getThis()); print_r($valera->getThis()); echo $petr->getFullInfo(); echo $valera->getFullInfo();

preferences:
24.02 ms | 404 KiB | 5 Q