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 9153649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:18:25+00:00 2026-06-17T12:18:25+00:00

My PHP code dosen’t work for some reason, I get an error on elseif

  • 0

My PHP code dosen’t work for some reason, I get an error on elseif. I can’t really figure it out because I’ve never used elseif but I’ve saw at YouTube you can use it but I really want some help to figure this one out, but it worked fine before i set $status1-2 = closedmsg1-2.
Do you know the answer or another way to do the $status1-2 = closedmsg1-2?
I’ve also searched a bit for “String Replacer” or “String Set” but i can’t find it.

<?php
//Made by Arnem\\

//\\Options//\\
$closed = 2000;
$opend = 1500;
$openmsg = '<p class=customfont>Streaming status: Online</p>';
$closemsg = '<h1 class=customfont2>Streaming is currently offline!</h1>';
$closemsg2 = '<p class=customfont>Streaming status: Offline</p>';
//DO NOT CONFIGURE UNDER THIS LINE!\\
$time = gmdate(H)+1 . gmdate(i);
if ($time>$closed)
$status1 = $closemsg;
$status2 = $closemsg2;
elseif ($time<$opend)
$status1 = $closemsg;
$status2 = $closemsg2;
else
$status2 = $openmsg;

echo$status1;
echo $status2;
?>
  • 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-17T12:18:25+00:00Added an answer on June 17, 2026 at 12:18 pm

    Try

    if ($time>$closed){
    $status1 = $closemsg;
    $status2 = $closemsg2;
    }elseif ($time<$opend){
    $status1 = $closemsg;
    $status2 = $closemsg2;
    }else{
    // are you missing $status1 here? could be why its not working
    $status2 = $openmsg;
    }
    

    You were missing the braces {}. The only time you can go without them is when its a single statement if/else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for some reason this code wont work, it doesn't seem to read the javascript.php
I'm reading opencart php source code, and I can't figure this out. Please take
For some reason the follow code doesn't work when the file has a php
Maybe I missed something really obvious but this code doesn't work: <pre> <?php print_r(($progress));
The following code works on my laptop but doesn't work on remote server: <?php
PHP code: echo date(c); //out put like this 2012-06-19T20:37:44+05:30 echo date(d M, Y); //out
My PHP code assigns an array to a Smarty variable that can be accessed
I am using CodeIgniter for PHP. Can anybody tell me why is this code
I have php code that doesn't work anymore $doc = DOMDocument::loadXML($string); $doc->formatOutput = true;
I have a PHP page with some JavaScript code also, but this JavaScript code

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.