3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php ini_set('display_errors', true); error_reporting(E_ALL); abstract class papa { public function __construct() { var_dump(__CLASS__ . '-' . __FUNCTION__); } } class son extends papa { public function son() { var_dump(__CLASS__ . '-' . __FUNCTION__); parent::papa(); } } var_dump('SON'); $boy = new son();
based on sv32G
Output for 7.0.0 - 7.2.6
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; son has a deprecated constructor in /in/sBJ9g on line 12 string(3) "SON" string(7) "son-son" Fatal error: Uncaught Error: Call to undefined method papa::papa() in /in/sBJ9g:15 Stack trace: #0 /in/sBJ9g(20): son->son() #1 {main} thrown in /in/sBJ9g on line 15
Process exited with code 255.
Output for 5.3.20 - 5.6.28
string(3) "SON" string(7) "son-son" Fatal error: Call to undefined method papa::papa() in /in/sBJ9g on line 15
Process exited with code 255.