3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("EVENT_YEAR",2000); function getInterval( $strDate ){ list( $year,,) = explode( '-', $strDate ); return ($year - EVENT_YEAR); } $strDate = '2017-05-05'; $interval = getInterval( $strDate ); try { $date = new DateTime( "$strDate -$interval years" ); } catch (Exception $e) { echo $e->getMessage(); exit(1); } if ( $date->format("Y-m-d") == '2000-05-05') { echo "\nThe interval is $interval years."; }
Output for git.master, git.master_jit, rfc.property-hooks
The interval is 17 years.

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