3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*$a = '12:21'; $b = '17:00'; $c = '09:00'; $d = '13:53'; $t1 = convertToSeconds(getTimeDiff($a,$b)); echo "\n"; $t2 = convertToSeconds(getTimeDiff($c,$d)); echo "\n"; echo gmdate("H:i",$t1+$t2);*/ $d = 4371960; $h = int($d/3600); $m = int(($d%3600)/60); echo "son $h:$m"; function convertToSeconds($time){ $a = explode(":", $time); $hora = $a[0]; $min = $a[1]; return $hora*3600+$min*60; } function getTimeDiff($dtime,$atime){ $nextDay=$dtime>$atime?1:0; $dep=explode(':',$dtime); $arr=explode(':',$atime); $diff=abs(mktime($dep[0],$dep[1],0,date('n'),date('j'),date('y'))-mktime($arr[0],$arr[1],0,date('n'),date('j')+$nextDay,date('y'))); $hours=floor($diff/(60*60)); $mins=floor(($diff-($hours*60*60))/(60)); $secs=floor(($diff-(($hours*60*60)+($mins*60)))); if(strlen($hours)<2){ $hours="0".$hours; } if(strlen($mins)<2){ $mins="0".$mins; } if(strlen($secs)<2){ $secs="0".$secs; } return $hours.':'.$mins.':'.$secs; }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 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
Fatal error: Uncaught Error: Call to undefined function int() in /in/UPHH5:15 Stack trace: #0 {main} thrown in /in/UPHH5 on line 15
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28
Fatal error: Call to undefined function int() in /in/UPHH5 on line 15
Process exited with code 255.

preferences:
239.27 ms | 402 KiB | 265 Q