3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myCustomThing { private $dt; public function __construct($date=NULL) { $this->dt = new DateTime($date); } public function __call($methodName, $args) { if (! method_exists($this, $methodName)) { return call_user_func_array([$this->dt, $methodName], $args); } } } $a = new myCustomThing('now'); echo $a->format('c');
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
2016-11-21T07:56:22+01:00
Output for 7.3.32 - 7.3.33, 8.0.13
2016-11-21T06:56:22+00:00

preferences:
219.47 ms | 401 KiB | 287 Q