3v4l.org

run code in 300+ PHP versions simultaneously
<?php $durations = array( 'P1Y', 'P1M', 'P1D', 'PT1H', 'PT1M', 'PT1S', 'P1Y1M', 'P1Y1D', 'P1M1D', 'P1YT1H', 'P1YT1M', 'P1YT1S', 'P1MT1H', 'P1MT1M', 'P1MT1S', 'P1DT1H', 'P1DT1M', 'P1DT1S', 'PT1H1M', 'PT1H1S', 'PT1M1S', 'P1Y1M1D', 'P1YT1H1M', 'P1YT1H1S', 'P1YT1M1S', 'P1Y1MT1H', 'P1Y1MT1M', 'P1Y1MT1S', 'P1Y1DT1H', 'P1Y1DT1M', 'P1Y1DT1S', 'P1MT1H1M', 'P1MT1H1S', 'P1MT1M1S', 'P1M1DT1H', 'P1M1DT1M', 'P1M1DT1S', 'P1DT1H1M', 'P1DT1H1S', 'P1DT1M1S', 'PT1H1M1S', 'P1YT1H1M1S', 'P1Y1MT1H1M', 'P1Y1MT1H1S', 'P1Y1MT1M1S', 'P1Y1M1DT1H', 'P1Y1M1DT1M', 'P1Y1M1DT1S', 'P1Y1DT1H1M', 'P1Y1DT1H1S', 'P1Y1DT1M1S', 'P1MT1H1M1S', 'P1M1DT1H1M', 'P1M1DT1H1S', 'P1M1DT1M1S', 'P1DT1H1M1S', 'P1Y1MT1H1M1S', 'P1Y1M1DT1H1M', 'P1Y1M1DT1H1S', 'P1Y1M1DT1M1S', 'P1Y1DT1H1M1S', 'P1M1DT1H1M1S', 'P1Y1M1DT1H1M1S', ); function date_interval_iso(DateInterval $interval, $default = 'PT0S') { static $f = array('M0S', 'H0M', 'DT0H', 'M0D', 'P0Y', 'Y0M', 'P0M'); static $r = array('M', 'H', 'DT', 'M', 'P', 'Y', 'P'); return rtrim(str_replace($f, $r, $interval->format('P%yY%mM%dDT%hH%iM%sS') ), 'PT') ?: $default; } $isos = array(); foreach ($durations as $duration) { $isos[] = date_interval_iso(new \DateInterval($duration)); } $diff = array_diff($durations, $isos); if (!empty($diff)) { //output any differences var_dump($diff); } else { echo 'No Differences' . PHP_EOL; } //test zero duration DateInterval $date1 = new DateTime(); echo date_interval_iso($date1->diff($date1));
Output for git.master, git.master_jit, rfc.property-hooks
No Differences PT0S

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:
74.62 ms | 405 KiB | 5 Q