3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class UserData{ public $user; public $userid; public function __construct($username, $userid){ $this->user = $username; $this->userid = $userid; } public function display(){ echo "Username is {$this->user} and user id is{$this->userid}"; } } class Admin extends UserData{ public $level; public function display(){ echo "Username is {$this->user} and user id is{$this->userid} and user level is ($this->level)"; } } $user = "mamun"; $id = "25"; $ur = new UserData($user, $id); echo "<br/>"; $ur->display(); echo "<br/>"; $ad = new Admin($user,$id); $ad->level ="Administrator"; $ad->display(); ?>
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc3
<br/>Username is mamun and user id is25<br/>Username is mamun and user id is25 and user level is (Administrator)