3v4l.org

run code in 300+ PHP versions simultaneously
<?php function datediffInWeeks($date1, $date2) { if($date1 > $date2) return datediffInWeeks($date2, $date1); $first = DateTime::createFromFormat('m/d/Y', $date1); $second = DateTime::createFromFormat('m/d/Y', $date2); return floor($first->diff($second)->days/7); } var_dump(datediffInWeeks('2016/03/12', '2016/03/31'));// 21
Output for git.master, git.master_jit
Fatal error: Uncaught Error: Call to a member function diff() on bool in /in/G9rvV:7 Stack trace: #0 /in/G9rvV(10): datediffInWeeks('2016/03/12', '2016/03/31') #1 {main} thrown in /in/G9rvV on line 7
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Uncaught Error: Call to a member function diff() on false in /in/G9rvV:7 Stack trace: #0 /in/G9rvV(10): datediffInWeeks('2016/03/12', '2016/03/31') #1 {main} thrown in /in/G9rvV on line 7
Process exited with code 255.

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