3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Demo { public function __construct(DateTimeImmutable $dateTime) { $this->date = $dateTime; } public function getDateTime(): DateTimeInterface { return $this->date; } public function echo() { echo $this->date->format("d/m/Y h:i:s"); } } $demo = new Demo(new DateTimeImmutable()); $demo->echo()."<br>"; $demo->getDateTime()->add(new DateInterval('P1D')); $demo->echo();
based on IWsq2
Output for 7.0.28 - 7.3.0rc3
30/10/2018 10:33:3830/10/2018 10:33:38
Output for 5.6.38
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/Qh0RV on line 7
Process exited with code 255.