jeudi 3 mars 2016

PHP getting errors by having an IF statement in an IF statement

Problem: I am getting constant errors while using this.

Error:
mod_fcgid: stderr: PHP Parse error: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) in /var/www/clients/client**/web***/web/****/data.php on line 101

Code: Here is a snippet of the code (the rest of the days is not relevant for the code)

class Day {
    function getDag($day) {
        $days = array();
        $whatdayisit = date("w");
        if($day == 1) {
            if ($whatdayisit == 1){
            array_push($days, strtotime("Monday"));
            array_push($days, strtotime("Monday + 1 day"));
            }
            else {
            array_push($days, strtotime("next Monday"));
            array_push($days, strtotime("next Monday + 1 day"));
            }
        }
        return $days;
}

Did I do research? Yes I did research. I searched for a long time on google and stackoverflow, but I just couldn't find an solution that suited my exact problem.

Aucun commentaire:

Enregistrer un commentaire