3v4l.org

run code in 300+ PHP versions simultaneously
<?php function monthsBetween($startDate, $endDate) { $retval = ""; // Assume YYYY-mm-dd - as is common MYSQL format $splitStart = explode('-', $startDate); $splitEnd = explode('-', $endDate); if (is_array($splitStart) && is_array($splitEnd)) { $difYears = $splitEnd[0] - $splitStart[0]; $difMonths = $splitEnd[1] - $splitStart[1]; $difDays = $splitEnd[2] - $splitStart[2]; $retval = ($difDays > 0) ? $difMonths : $difMonths - 1; $retval += $difYears * 12; } return $retval; } echo monthsBetween('2014-06-16','2015-05-16'); ?>
Output for git.master, git.master_jit, rfc.property-hooks
10

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
39.12 ms | 401 KiB | 8 Q