3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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; }
based on PlIPo
Output for 7.0.0 - 7.2.0
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.6.28
Fatal error: Call to undefined function int() in /in/UPHH5 on line 15
Process exited with code 255.