Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8588817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:53:48+00:00 2026-06-11T22:53:48+00:00

Trying to write part of a page that would display a streaming player when

  • 0

Trying to write part of a page that would display a streaming player when we are on the air 5a-10a M-F and display something else when we aren’t on the air.

Here’s what I have right now, but it’s not working. I’m pretty new at PHP. Thanks!

<html>
<head>
<title>streaming</title>
</head>
<body>
<?php

//Get the current hour
$current_time = date(G);
//Get the current day
$current_day = date(l);

//Off air
if ($current_day == "Saturday" or $current_day == "Sunday" or ($current_time <= 5 && $current_time >= 10)) {
echo "We’re live Monday – Friday mornings. Check back then.";
}

// Display player
else {
echo "<a href="linktoplayer.html"><img src=http://www.psdgraphics.com/wp-content/uploads/2009/09/play.jpg></a>";
}


?>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:53:49+00:00Added an answer on June 11, 2026 at 10:53 pm

    Two things:

    1. As has been pointed out, your time logic is off. It should be $current_time < 5 or $current_time >= 10)

    2. When you give something to the date function, it has to be a string. date(l) will throw an error because it’s supposed to be date('l').

    EDIT:

    If you really want to benchmark your code, you should use idate instead since it returns an integer. Your comparisons would then be as follows:

    $current_time = idate('H');
    $current_day = idate('w');
    
    if ($current_day === 0 || $current_day === 6 || 
        $current_time < 5 || $current_time >= 10) {
        echo "We’re live Monday – Friday mornings. Check back then.";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write some validation as part of my page that makes
Trying to write app for service technicians that will display open service calls within
I'm trying to write a script in jQuery that would iterate through each text
I am trying to write an extension that will cache page content for offline
I'm trying to write a web part that will log some performance metrics to
I am trying to write a simple console app that POSTs to a page
I m trying write code that after reset set up rrpmax as 3000. It
I am trying write a function that generates simulated data but if the simulated
Trying to write a couple of functions that will encrypt or decrypt a file
Trying to write a code at the moment that basically tests to see if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.