3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date1 = new DateTime('2010-01-25'); $date2 = new DateTime('2010-02-20'); $interval = $date2->diff($date1); $months = ($interval->y * 12) + $interval->m; $months += number_format($interval->d / 30, 1); echo $months;

preferences:
49.96 ms | 402 KiB | 5 Q