3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Converts a 'decimal time' in the format 1.5hours to DateInterval object * * @param Int $decimalTime * @return DateInterval */ function decTimeToInterval($decimalTime) { $hours = floor($decimalTime); $decimalTime -= $hours; $minutes = floor($decimalTime * 60); $decimalTime -= ($minutes/60); $seconds = floor($decimalTime * 600); $interval = new \DateInterval("PT{$hours}H{$minutes}M{$seconds}S"); return $interval; } echo decTimeToInterval(4.5)->format("%H:%I:%S");
Output for git.master, git.master_jit, rfc.property-hooks
04:30: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:
51.03 ms | 401 KiB | 8 Q