This forum is now read-only. Please use our new forums! Go to forums
What am i doing wrong in "your first IF"?
idk what im doing wrong but im sure im doing something wrong since its not going through lol. heres my code:
<html>
<head>
<title>Our Shop</title>
</head>
<body>
<p>
<?php
$items = 10 // Set this to a number greater than 5!
if ($items > 5); {
echo "You get a 10% discount!";
}
?>
</p>
</body>
</html>
it says Parse error: syntax error, unexpected T_IF on line 9 and Oops, try again! Did you replace the second blank with { ? the second blank is where the { is..
Answer 51899f401f6131166e000b10
You are missing the semicolon after $items = 10 The error code mentions line 9. Always look at that number since it tells you that your error is on the indicated or before the line indicated.
Answer 5194f2dd108bbe4ea6003c2c
The variable needs a semicolon, so change it to “$items = 10;”
Answer 51871b7a006ea42c5b002954
oh and on my screen this is what line 9 would be:
if ($items > 5); {
3 comments
Are you mad? You should not add the semicolon after “if ($items > 5)” because the statement is not yet completed. However the code should be something like this:
Lol, I didn’t notice that one! It is definitely a no-no, it terminates the conversation even before it starts.
maybe i should retouch on my semi colon theories XD lulz
Answer 518818bd1caad14b71001124
if ($items > 5) {
Answer 51d22c43282ae38949002b88
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
thats actually really good advice ill keep that in mind from now on :)