3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Person{ public $name; public $age; public function __construct(){ echo "constructor created.<br>"; } public function personName(){ echo "Person Name : ".$this->name; } public function personAge($age){ echo "Person Name : ".$this->age = $age; } } $personOne = new person; $personOne->name = "akbar hossain"; $personOne->personName(); echo "<br>"; $personOne->personAge(); ?>
Output for 7.1.0 - 7.3.0rc3
constructor created.<br>Person Name : akbar hossain<br> Fatal error: Uncaught ArgumentCountError: Too few arguments to function Person::personAge(), 0 passed in /in/U8K0U on line 22 and exactly 1 expected in /in/U8K0U:13 Stack trace: #0 /in/U8K0U(22): Person->personAge() #1 {main} thrown in /in/U8K0U on line 13
Process exited with code 255.
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20
constructor created.<br>Person Name : akbar hossain<br> Warning: Missing argument 1 for Person::personAge(), called in /in/U8K0U on line 22 and defined in /in/U8K0U on line 13 Notice: Undefined variable: age in /in/U8K0U on line 14 Person Name :
Output for hhvm-3.15.4
constructor created.<br>Person Name : akbar hossain<br> Warning: personAge() expects exactly 1 parameter, 0 given in /in/U8K0U on line 14 Notice: Undefined variable: age in /in/U8K0U on line 14 Person Name :