[php] date check Sunday and Saturday

Function date_format() with Parameter “w”

w – A numeric representation of the day

0 = Sunday
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday

<?php
$dayofweek = date('w');
echo $dayofweek;
?>

Output

6

Find Saturday or Sunday

<?php
$dayofweek = date('w');

if($dayofweek == 0 or $dayofweek == 6){
    echo 'Yes';
}

?>

Output

Yes