3v4l.org

run code in 300+ PHP versions simultaneously
<?php $workdays = array(); $type = CAL_GREGORIAN; $month = date('n'); // Month ID, 1 through to 12. $year = date('Y'); // Year in 4 digit 2009 format. $day_count = cal_days_in_month($type, $month, $year); // Get the amount of days $current_date = date('Y/n/j'); //loop through all days for ($i = 1; $i <= $day_count; $i++) { $date = $year.'/'.$month.'/'.$i; //format date $get_name = date('l', strtotime($date)); //get week day $day_name = substr($get_name, 0, 3); // Trim day name to 3 chars //if not a weekend add day to array if($day_name != 'Sun' && $day_name != 'Sat' && $date <= $current_date){ $workdays[] = $date; } } foreach($workdays as $bd){ echo $bd.'<br>'; }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "CAL_GREGORIAN" in /in/7A3It:4 Stack trace: #0 {main} thrown in /in/7A3It on line 4
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:
61.72 ms | 401 KiB | 8 Q