3v4l.org

run code in 300+ PHP versions simultaneously
<?php $difference = new DateTime(); $difference = $difference->diff(new DateTime('now + 2 years + 1 month + 2 weeks + 3 days + 40 seconds'), true); $periods = array( 'y' => 'year', 'm' => 'month', 'd' => 'day', 'h' => 'hour', 'i' => 'minute', 's' => 'second' ); foreach($periods as $attribute => $verb) { var_dump($difference->$attribute); if(isset($difference->$attribute) && $difference->$attribute !== 0) { die((string) $verb); } }
Output for git.master, git.master_jit, rfc.property-hooks
int(2) year

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