3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class BaseClass { function __construct($val, $var) { print "Конструктор класса BaseClass\n"; } } class SubClass extends BaseClass { function __construct($val, $var, $myvar) { parent::__construct(); print "Конструктор класса SubClass\n"; } } // In BaseClass constructor $obj = new BaseClass(1,2); // In BaseClass constructor // In SubClass constructor $obj = new SubClass(1,2,3);
based on SqR9I
Output for 7.1.0 - 7.2.0
Конструктор класса BaseClass Fatal error: Uncaught ArgumentCountError: Too few arguments to function BaseClass::__construct(), 0 passed in /in/6TEoR on line 10 and exactly 2 expected in /in/6TEoR:3 Stack trace: #0 /in/6TEoR(10): BaseClass->__construct() #1 /in/6TEoR(21): SubClass->__construct(1, 2, 3) #2 {main} thrown in /in/6TEoR on line 3
Process exited with code 255.
Output for 5.3.21 - 7.0.20
Конструктор класса BaseClass Warning: Missing argument 1 for BaseClass::__construct(), called in /in/6TEoR on line 10 and defined in /in/6TEoR on line 3 Warning: Missing argument 2 for BaseClass::__construct(), called in /in/6TEoR on line 10 and defined in /in/6TEoR on line 3 Конструктор класса BaseClass Конструктор класса SubClass