-5

So im having issue with my code. Im trying to implement multiple mktime functions to PHP code using if and else if values but still im getting something wrong. I dont know what could be wrong. I get error PHP check online and i have fixed the code abit, but still i get the error Here is the code

<?
// Check if clock is 4:20am/4:20pm (12h clock) or 4:20/16:20 (24h clock)
if (time() = mktime(4,20,0,0,0,0));
    require_once('doc.html');
else if
    (time() > mktime (4,20,0,0,0,0));
    require_once('doc2.html');
else if
    (time() = mktime(16,20,0,0,0,0));
    require_once('doc2.tml');
else if
    (time() > mktime(16,20,0,0,0,0));
    require_once('doc2.html');
?>
JantsoP
  • 1
  • 2
  • 7
    `=` is assign. Use `==` in the if conditions. – AKS May 28 '14 at 08:05
  • Why's these many minus for an OP making just his second question showing effort –  May 28 '14 at 08:09
  • You might want to read the following help pages: ["How do I ask a good question?"](http://stackoverflow.com/help/how-to-ask) and ["How to create a Minimal, Complete, and Verifiable example"](http://stackoverflow.com/help/mcve). These pages will help you to improve your question. – Jaap May 28 '14 at 08:29

1 Answers1

-1

Try this:

// Check if clock is 4:20am/4:20pm (12h clock) or 4:20/16:20 (24h clock)
if (time() == mktime(4,20,0,0,0,0)) {
    require_once('doc.html');
} else if {
    (time() > mktime (4,20,0,0,0,0));
    require_once('doc2.html');
} else if {
    (time() == mktime(16,20,0,0,0,0));
    require_once('doc2.tml');
} else if {
    (time() > mktime(16,20,0,0,0,0));
    require_once('doc2.html');
}

Your must use == statement for check equals.

ZhukV
  • 2,892
  • 6
  • 25
  • 36
  • Well now it tells me that i have Parse error: syntax error, unexpected 'else' (T_ELSE) in your code on line 5 – JantsoP May 28 '14 at 08:09
  • dont forget the {} brackets on more than 1 lines of blocks –  May 28 '14 at 08:12
  • -1, I cant beleive,How did OP accepted this error code.How could you have `if` without conditions ? – krishna May 28 '14 at 08:34