[Solved] How to simplify this php code [closed]


Try:

<?php
$include="";

    if( in_array($day, array('Mon', 'Tue', 'Wed', 'Thu', 'Fri') ) && ($hour >= 6 && $hour < 22) ) {

        $include = $detect->isMobile() ? 'online_mobile' : 'online_desktop';
    }

    if($day == 'Sat'  && ($hour >= 8 && $hour < 18)) {
        $include = $detect->isMobile() ? 'online_mobile' : 'online_desktop'; 
    }

    if($day == 'Sun'  && ($hour >= 8 && $hour < 18)) {
        $include = $detect->isMobile() ? 'online_mobile' : 'online_desktop';
} else {
    $include = $detect->isMobile() ? 'closed_mobile' : 'closed_desktop'; 
}        

include $include.'php';

4

solved How to simplify this php code [closed]