3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = new DateTimeImmutable("2019-01-01 00:00:00"); $end1 = new DateTimeImmutable("2019-02-01 00:00:00"); $end2 = new DateTimeImmutable("2019-02-01 12:00:00"); $diff1 = $start->diff($end1); $diff2 = $start->diff($end2); // Same number of days var_dump($diff1->days == $diff2->days); // Comparing doesn't work, though var_dump($diff1 == $diff2); // true? var_export($diff1, true); var_export($diff2, true); // Now it does var_dump($diff1 == $diff2); // false, as it should be var_dump($diff1 < $diff2); // true, as it should be var_dump($diff1 > $diff2); // false, as it should be
Output for git.master, git.master_jit, rfc.property-hooks
bool(true) Warning: Cannot compare DateInterval objects in /in/5QC3W on line 14 bool(false) Warning: Cannot compare DateInterval objects in /in/5QC3W on line 20 bool(false) Warning: Cannot compare DateInterval objects in /in/5QC3W on line 21 bool(false) Warning: Cannot compare DateInterval objects in /in/5QC3W on line 22 bool(false)

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