3v4l.org

run code in 300+ PHP versions simultaneously
<?php // get the old DateTime object created from the month and year $oldDate = date_create_from_format("n Y", "10 2013"); // get the current DateTime object $currentDate = new DateTime(); // calculate the interval between the two $dateInterval = $currentDate->diff($oldDate,true); echo $dateInterval->m;

preferences:
43.58 ms | 402 KiB | 5 Q