3v4l.org

run code in 300+ PHP versions simultaneously
<?php $beginday=date('Y-m-01'); $lastday=date('Y-m-t'); $nr_work_days = getWorkingDays($beginday,$lastday); echo $nr_work_days; function getWorkingDays($startDate, $endDate){ $begin=strtotime($startDate); $end=strtotime($endDate); if($begin>$end){ echo "startdate is in the future! <br />"; return 0; }else{ $no_days=0; $weekends=0; while($begin<=$end){ $no_days++; // no of days in the given interval $what_day=date("N",$begin); if($what_day<=5) { // 6 and 7 are weekend days $working_days++; }; $begin+=86400; // +1 day }; $working_days=$no_days-$weekends; return $working_days; } }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $working_days in /in/9ScI6 on line 22 31

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