samedi 14 mars 2020

why does my code not run even though I have no syntax error on php [duplicate]

I am trying to understand different 'if statements but keep seeing an error before it even works.

The error I see is:

Parse error: syntax error, unexpected 'echo' (T_ECHO) in /opt/lampp/htdocs/testphp.php on line 30

The code i'm using is:

<!DOCTYPE html>
<html>
    <head>

        <meta charset="utf-8">
        <title> </title>

    </head>
    <body>


        <?php 

            $isMale = false;
            $isTall = false;

            if($isMale && $isTall){
                echo "You are a tall male";
            }

            elseif($isMale && !$isTall){
                echo "You are a short male";
            }

            elseif(!$isMale && $isTall){
                echo "You are not a male but you are tall";
            }

            else(!$isMale && !$isTall){
                echo "You are not male and you are not tall";
            }

        ?>


    </body>

</html>

Can someone help me?

Aucun commentaire:

Enregistrer un commentaire