0

I'm having this boring issue. I have looked around here on Stackoverflow but I can't get what is wrong. On another hosting platform I don't have this error. This is line 150:

    else if ((date('m') == 08) && (date('d') == 02)) {
    echo "<span> Lughnasad </span>";
    }   

And this is the entire code:

<div class="info_event">
<?php 
    // TEST LINE
    if ((date('m') == 01) && (date('d') >= 01)) {
    echo "<span> Inizio dell'anno </span>";
    }   
    // WICCA - Imbolc 
    else if ((date('m') == 02) && (date('d') == 02)) {
    echo "<span> Imbolc </span>";
    }  
    // St. Patrick's Day
    else if ((date('m') == 03) && (date('d') == 17)) {
    echo "<span> St. Patrick's Day </span>";
    }   
    // WICCA - Oestara
    else if ((date('m') == 03) && (date('d') == 21)) {
    echo "<span> Oestara </span>";
    }
    // WICCA - Beltane
    else if ((date('m') == 05) && (date('d') == 01)) {
    echo "<span> Beltane </span>";
    }   
       // Labour Day
    else if ((date('m') == 05) && (date('d') == 02)) {
    echo "<span> Labour Day </span>";
    }   
    // Victoria Day
    else if ((date('m') == 05) && (date('d') == 24)) {
    echo "<span> Victoria Day </span>";
    }       
    // WICCA - Litha
    else if ((date('m') == 06) && (date('d') == 21)) {
    echo "<span> Litha </span>";
    }
       // WICCA - Lughnasad
    else if ((date('m') == 08) && (date('d') == 02)) {
    echo "<span> Lughnasad </span>";
    }   
     // WICCA - Mabon
    else if ((date('m') == 09) && (date('d') == 21)) {
    echo "<span> Mabon </span>";
    }   
    // WICCA - Samhain / Halloween
    else if ((date('m') == 10) && (date('d') >= 31) || (date('m') == 11) && (date('d') <= 01)) {
    echo "<span> Samhain / Halloween </span>";
    }  
    // St. Andrew's Day
    else if ((date('m') == 11) && (date('d') == 30)) {
    echo "<span> St. Andrew's Day </span>";
    }   
 // WICCA - Yule
    else if ((date('m') == 12) && (date('d') == 21)) {
    echo "<span> Yule </span>";
    }  
 // Natale
    else if ((date('m') == 12) && (date('d') == 25)) {
    echo "<span> Natale </span>";
    }   
 // Boxing Day
    else if ((date('m') == 12) && (date('d') == 26)) {
    echo "<span> Boxing Day </span>";
    }   
 // Hogmanay
    else if ((date('m') == 12) && (date('d') == 31)) {
    echo "<span> Hogmanay </span>";
    }
    else {
    echo "<span>Nessun evento</span>";
    }
?>

</div>
Lee Scott
  • 5
  • 2
  • 1
    `02` and `08` are strings, not numbers. Quote them `'02'` and `'08'`. Edit all of your strings beginning with `0` – Jay Blanchard Jul 18 '20 at 17:55
  • The error is down to the fact that as the numbers start with `0` they are assumed to be octal and `08` is invalid in octal ([Use numbers starting with 0 in a variable in php](https://stackoverflow.com/questions/19354208/use-numbers-starting-with-0-in-a-variable-in-php)) But as already stated, you probably meant them to be strings. – Nigel Ren Jul 18 '20 at 17:59
  • 3
    Does this answer your question? [Parse error: Invalid numeric literal](https://stackoverflow.com/questions/40735963/parse-error-invalid-numeric-literal) – GNassro Jul 18 '20 at 18:00

1 Answers1

1

In this case, 02 and 08 are strings, not numbers. Quote them '02' and '08'. Edit all of your strings beginning with 0

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119