3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = new \DateTime('2006-04-12T12:30:00'); $end = new \DateTime('2006-04-14T11:30:00'); //determine what interval should be used - can change to weeks, months, etc $interval = new \DateInterval('PT1H'); //create periods every hour between the two dates $periods = new \DatePeriod($start, $interval, $end); //count the number of objects within the periods $hours = iterator_count($periods); echo $hours . ' hours' . PHP_EOL; //difference between Unix Epoch $diff = $end->getTimestamp() - $start->getTimestamp(); $hours = $diff / ( 60 * 60 ); echo $hours . ' hours (60 * 60)' . PHP_EOL; //difference between days $diff = $end->diff($start); $hours = $diff->h + ($diff->days * 24); echo $hours . ' hours (days * 24)' . PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
47 hours 47 hours (60 * 60) 47 hours (days * 24)

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:
113.09 ms | 405 KiB | 5 Q