3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dateTimeDiff($start, $end, $units = 'Days') { $start_ts = strtotime($start); $end_ts = strtotime($end); $diff = $end_ts - $start_ts; $divider = 86400; if ($units != 'Days') { $divider = $divider / 24; if ($units != 'Hours') { $divider = $divider / 60; if ($units != 'Minutes') { $divider = $divider / 60; } } } return round($diff / $divider); } echo "\n our function: "; echo dateTimeDiff(date('Y-m-d'), '16-10-2013'); $datetime1 = date_create('15-10-2013'); $datetime2 = date_create('16-10-2013'); $interval = date_diff($datetime1, $datetime2); echo "\n php function: "; echo $interval->format('%R%a dias');
Output for git.master, git.master_jit, rfc.property-hooks
our function: 1 php function: +1 dias

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