While
$w is an Array ( [0] => 4, [1] => 6 )
what does this expression mean:
$day == $w[0] || $day == $w[1] || $day < ((7 + $w[1] - $w[0]) % 7);
Please, help. I have not seen the statement ||inside, except for the if or while statement. Thanks.
EDIT 01:
This is the original function in which it is used to search for a specific day in a date range:
function number_of_days($day, $start, $end){
$w = array(date('w', $start), date('w', $end));
return floor( ( date('z', $end) - date('z', $start) ) / 7) + ($day == $w[0] || $day == $w[1] || $day < ((7 + $w[1] - $w[0]) % 7));
}
It was not created by me. But I wanted to edit this function, because when the end of the day is Saturday, it also takes into account next Sunday, which is wrong.
source
share