3v4l.org

run code in 300+ PHP versions simultaneously
<?php function date_interval_iso(DateInterval $interval, string $default = 'PT0F') { static $f = ['S0F', 'M0S', 'H0M', 'DT0H', 'M0D', 'P0Y', 'Y0M', 'P0M']; static $r = ['S', 'M', 'H', 'DT', 'M', 'P', 'Y', 'P']; return rtrim(str_replace($f, $r, $interval->format('P%yY%mM%dDT%hH%iM%sS%fF') ), 'PT') ?: $default; } $date1 = new DateTimeImmutable(); $date2 = new DateTimeImmutable(); //test 0 duration DateInterval echo date_interval_iso($date1->diff($date1)) . PHP_EOL; //test microseconds echo date_interval_iso($date2->diff($date1));
Output for git.master, git.master_jit
PT0F PT6F
Output for rfc.property-hooks
PT0F PT3F

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:
119.26 ms | 406 KiB | 5 Q