3v4l.org

run code in 300+ PHP versions simultaneously
<?php function weekCounter($startDate,$endDate){ //calculate # of full weeks between dates $secsPerWeek = 60 * 60 * 24 * 7; $fullWeeks = floor((strtotime($endDate) - strtotime($startDate))/$secsPerWeek); $fullMonths = floor($fullWeeks/4); $weeksRemainder = $fullWeeks % 4; // weeks that don't fit in a month return "Months: $fullMonths, Weeks: $weeksRemainder"; } $startDate = '2016-06-13'; $endDates = ['2016-06-20','2016-06-27','2016-07-04']; foreach($endDates as $endDate) echo weekCounter($startDate,$endDate)."\n";
Output for git.master, git.master_jit, rfc.property-hooks
Months: 0, Weeks: 1 Months: 0, Weeks: 2 Months: 0, Weeks: 3

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:
69.17 ms | 401 KiB | 8 Q