3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo date('Y-m-d', strtotime('+4 months')); echo "\n"; $d1 = new \Datetime('2017-6-1'); $d2 = new \Datetime('2017-7-1'); $diff = $d1->diff($d2); echo sprintf('%d Month\\s', $diff->m) . PHP_EOL; echo sprintf('...But %d Day\\s', $diff->d) . PHP_EOL;

preferences:
36.78 ms | 406 KiB | 5 Q