- Output for 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
- 25 James
<?php
class Person{
var $name;
function __construct(string $name){
$this->name = $name;
}
}
class Student extends Person{
public int $age;
function __construct(int $age, string $name){
parent::__construct($name);
$this->age = $age;
}
}
$ob = new Student(25, "James");
echo $ob->age, " " ,$ob->name;