3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( array(new DateTime(), new DateTime('2013-12-31')), array(new DateTime('2013-10-28'), new DateTime('2013-12-31')), ); foreach($data as $parameters) { var_dump(call_user_func_array('getDateDifferenceAsDays', $parameters)); var_dump(call_user_func_array('getDateDifferenceAsDays2', $parameters)); } function getDateDifferenceAsDays(\DateTime $dateStart, \DateTime $dateEnd) { $refDateStart = new \DateTime($dateStart->format('Y-m-d')); $refDateEnd = new \DateTime($dateEnd->format('Y-m-d')); $interval = $refDateStart->diff($refDateEnd); return (int)$interval->format('%R%a'); } function getDateDifferenceAsDays2(\DateTime $dateStart, \DateTime $dateEnd) { $refDateStart = clone $dateStart; $refDateEnd = clone $dateEnd; $interval = $refDateStart->diff($refDateEnd); return (int)$interval->format('%R%a'); } ?>
Output for git.master, git.master_jit, rfc.property-hooks
int(60) int(59) int(64) int(64)

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