3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strToDuration($str) { sscanf($str, '%d:%d:%d', $hours, $minutes, $seconds); return $seconds + ($minutes * 60) + ($hours * 60 * 60); } function durationToStr($duration) { $hours = floor($duration / (60 * 60)); $seconds %= 60 * 60; $minutes = floor($seconds / 60); $seconds %= 60; return sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds); } $morning = '16:05:12'; $evening = '18:05:29'; echo durationToStr(strToDuration($morning) + strToDuration($evening));
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $seconds in /in/LE6L5 on line 10 34:00:00

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