3v4l.org

run code in 300+ PHP versions simultaneously
<?php $in = trim('March 8 - 10'); $now = new DateTime(); // Defaults to now $start = DateTime::createFromFormat('F j+', $in); // Parse month and day, ignore the rest if ($now > $start) { $start->modify("next year"); } $end = clone $start; $end->setDate( $end->format('Y'), // $start year $end->format('n'), // $start month substr($in, strrpos($in, ' ') + 1) // trailing bit of $in for day ); echo $start->format("Y-m-d"), "\n"; echo $end->format("Y-m-d");
Output for git.master, git.master_jit, rfc.property-hooks
2016-03-08 2016-03-10

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