3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start_date = '2014-3-19'; $end_date = '2014-5-19'; $begin = new DateTime( $start_date ); $end = new DateTime(date("Y-m-d",strtotime("+1 day", strtotime($end_date)))); while($begin < $end) { if(isWeekend($begin)) { $period[] = $begin->format('Y-m-d'); $begin->modify('+1 day'); } } foreach($period as $val) { print_r("Value: " . $val . (isWeekend($val) ? " - weekend\n" : " - weekday\n")); } function isWeekend($date) { return (date('N', strtotime($date)) >= 6); }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: strtotime(): Argument #1 ($datetime) must be of type string, DateTime given in /in/YKYcr:20 Stack trace: #0 /in/YKYcr(20): strtotime(Object(DateTime)) #1 /in/YKYcr(9): isWeekend(Object(DateTime)) #2 {main} thrown in /in/YKYcr on line 20
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:
35.33 ms | 401 KiB | 8 Q