All on your own


#1

I am having problem with printing , here is my error "Parse error: syntax error, unexpected T_SWITCH on line 9" i completed it , with that error , i want to fix it somehow , can you help me ?






<?php
$Age = 18
switch ($Age) {
case 18:
echo "you are an adult";
break;
case 19;
echo "you are older than 18";
break;
case 20;
echo "You are older than 19";
break;
default;
echo "You are an child";
break;
}

?>
</body>


#2

You dropped this: ;


#3

Oh , i didnt noticed , thanks for the help


#4

Now i have other error : Parse error: syntax error, unexpected T_ENDSWITCH, expecting T_CASE or T_DEFAULT or '}' on line 22
I tried to place endswitch;
here is my code :

<?php
$i = 18;
switch ($i) {
case 18:
echo "you are an adult";
break;
case 19:
echo "you are older than 18";
break;
case 20:
echo "You are older than 19";
break;
default:
echo "You are an child";
break;
endswitch;
}


#5

Hi if you use endswitch you should remove the { }

switch ($i) {

}

Or

switch ($i) :


endswitch;