0
Whats wrong with my code ?
<?php $life= "you"; if ($life=="you");{ echo"you're my life "; break; } elseif ($life !="you");{ echo "you're not my life"; break; } else echo " its either you're my life or not"; ?>
8 Réponses
+ 8
The code is kinda weird, but still.. -_-
Don't use break inside if-else.
There will be no semicolon after the conditions
<?php
$life= "you";
if ($life=="you"){
echo"you're my life ";
}
elseif ($life !="you"){
echo "you're not my life";
}
else
echo " its either you're my life or not";
?>
0
haha noted advised thanks :)
- 1
what warning are you getting?
- 1
Parse error: syntax error, unexpected 'elseif' (T_ELSEIF), expecting end of file in ..\Playground\ PHP Parse error: syntax error, unexpected 'elseif' (T_ELSEIF), expecting end of file in ..\Playground\
- 1
try "else if" not "elseif"
- 1
noted , gonna try it thanks
- 1
I'm not familiar with php i just took a quick glimpse to see a typo so sorry if my answer isn't correct
- 1
why not try if, if, else? thats if it has any similarities to java.