3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = new DateTime("2018-01-02"); $y = new Date(); $y->setDate(date("Y"), date("m"), $x->format("d")); echo $y->format("d.m.Y");

preferences:
30.83 ms | 402 KiB | 5 Q