3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = get_minutes('02:50'); $b = get_minutes('08:30'); /*echo intval(($b+30)/60); echo " "; echo ($b+30)%60;*/ $d = $b-$a; $intervalo = 15; $citas = $d/$intervalo; for($i=0;$i<$citas;$i++){ $horaCom = intval($a/60); $horaTer = intval(($a+$intervalo)/60); $minCom = $a%60; $minTer = ($a+$intervalo)%60; echo $horaCom.":".$minCom."-".$horaTer.":".$minTer."\n"; $a=$a+$intervalo; } function get_minutes($time_string) { $parts = explode(":", $time_string); $hours = intval($parts[0]); $minutes = intval($parts[1]); return $hours * 60 + $minutes; }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
2:50-3:5 3:5-3:20 3:20-3:35 3:35-3:50 3:50-4:5 4:5-4:20 4:20-4:35 4:35-4:50 4:50-5:5 5:5-5:20 5:20-5:35 5:35-5:50 5:50-6:5 6:5-6:20 6:20-6:35 6:35-6:50 6:50-7:5 7:5-7:20 7:20-7:35 7:35-7:50 7:50-8:5 8:5-8:20 8:20-8:35

preferences:
353.07 ms | 406 KiB | 459 Q