3v4l.org

run code in 300+ PHP versions simultaneously
<?php $staff = array(1,2,3,4,5); $start = array("11:05", "11:00", "19:00", "13:00", "19:00"); $end = array("20:00", "17:00", "03:00", "20:00", "03:05"); array_multisort($start, $end, $staff); $aloneStart = (strtotime($start[1]) - strtotime($start[0]))/60; // first and second items are the ones that may be working alone at start $aloneEnd = (strtotime($end[count($end)-1]) - strtotime($end[count($end)-2]))/60; // last and second to last are the ones that may be working alone at end if($aloneStart > 0){ $staffAloneStart = $staff[0]; //must be the first who worked alone echo "minutes alone at start: " . $aloneStart . " and it was " . $staffAloneStart . "\n"; } if($aloneEnd > 0){ $staffAloneEnd = $staff[count($end)-1]; // must be the last to end that worked alone echo "minutes alone at end: " . $aloneEnd . " and it was " . $staffAloneEnd . "\n"; } $aloneTime = intval($aloneStart)+intval($aloneEnd); echo "total time alone " . $aloneTime;
Output for git.master, git.master_jit, rfc.property-hooks
minutes alone at start: 5 and it was 2 minutes alone at end: 5 and it was 5 total time alone 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:
44.71 ms | 401 KiB | 8 Q