3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('date.timezone', 'America/New_York'); //current date is 2019-01-04 08:33:30 $_POST['expire'] = '2019-01-04T08:32'; $current_date = new \DateTime('2019-01-04 08:33:30'); if ($expire_date = \DateTime::createFromFormat('Y-m-d\TH:i|', $_POST['expire'])) { if ($expire_date < $current_date) { /* example purposes only */ $diff = $expire_date->diff($current_date); echo 'Expired ' . $diff->format('%y years %m months %d days %h hours %i minutes %s seconds') . ' ago'; //do the thing } } else { die('Invalid Date Format Provided'); }
Output for git.master, git.master_jit, rfc.property-hooks
Expired 0 years 0 months 0 days 0 hours 1 minutes 30 seconds ago

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