3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ExtendsDateTime extends DateTime { public $onConstruct; public function __construct($value, $tz = null) { parent::__construct($value, $tz); $this->onConstruct = true; } public static function createFromFormat($format, $datetime, $timezone = null) { return parent::createFromFormat($format, $datetime); } } $date = ExtendsDateTime::createFromFormat('Y-m-d', '2014-02-14'); var_dump($date instanceof ExtendsDateTime); echo "onConstruct\n"; var_dump($date->onConstruct);
based on csah3
Output for 8.0.0beta1 - rc2
bool(true) onConstruct NULL
Output for 8.0.0alpha1 - alpha3
bool(false) onConstruct Warning: Undefined property: DateTime::$onConstruct in /in/LqeX2 on line 18 NULL
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.23, 7.4.0 - 7.4.11
bool(false) onConstruct Notice: Undefined property: DateTime::$onConstruct in /in/LqeX2 on line 18 NULL