根据时间显示DIV - PHP

The goal is to get a Live Chat link to show on the page during business hours but not show when closed. The following PHP works on our test server but not our client's server. Any ideas why it could work on one and not the other? Both are Apache managed through GoDaddy.

PHP:

<style>
    .timeBasedLink {
    <?php
        date_default_timezone_set('America/Los_Angeles');
        $currentTime = date('H:i a');
        $openTime = "8:00 am";
        $closeTime = "6:00 pm";
        $open = DateTime::createFromFormat('H:i a', $openTime);
        $close = DateTime::createFromFormat('H:i a', $closeTime);
        $open = $open->format('H:i a');
        $close = $close->format('H:i a');
        if ($currentTime > $open && $currentTime < $close)
    { ?>
    display: block;
    <?php
    }
    else
    {
    ?>
    display:none;
    <?php
    }
    ?>
    }
</style>

HTML:

<div class="timeBasedLink">
    Put time-sensitive material here.
</div>

Since the opening/closing time doesn't involve minutes, you can use full integers based off the 24 hour clock. Whereas the opening time is 8 (0800) and the closing time is 18 (1800). Then it's just a simple if statement. I've put the php above the CSS for clarity:

date_default_timezone_set('America/Los_Angeles');
$currentHour = date("H");
$openTime = 8;
$closeTime = 18;
if ($currentHour >= $openTime && $currentTime < $closeTime){
    $css = 'display:block;';
}else{
    $css = 'display:none;';
}

echo '<style type="text/css">.timeBasedLink {'.$css.'}</style>';