3v4l.org

run code in 300+ PHP versions simultaneously
<?php $format="Y-m"; $date="2018-02"; $d = DateTime::createFromFormat($format, $date); echo ($d->format($format)); echo "\n" . date_format($d, $format);

preferences:
67.34 ms | 408 KiB | 6 Q