Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

IF/ELSE Statement

I keep getting a parse error with my first if statement. It looks good to me. Can someone please tell me if/what I did wrong?

<?php
// Program lines of code
$apollo11 = 145000;
$android = 12000000;
$osx = 86000000;

// Step 1: Create a variable named 'myLines' and set it's value equal to the integer 4000000
$myLines = 4000000  
// Step 2: Use an if statement to check whether 'myLines' is greater than $osx, and if so, display the string "You have written more code than is included in MacOS 10.4."  
if ($myLines > $osx) {
  echo "You have written more code than is included in MacOS 10.4.";
  // Step 3: Add an else if statement to check whether 'myLines' is greater than $android, and if so, display the string "You have written more code than it takes to run an Android phone."
} elseif ( $myLines > $android ) {
  echo "You have written more code than it takes to run an andoid phone.";
  // Step 4: Add another else if statement to check whether 'myLines' is greater than $apollo11, and if so, display the string 
  "You have written more code than it took to launch Apollo 11."
} elseif ( $myLines > $apollo11 ) {
  echo "You have written more code than it took to launch Apollo.";
}
// Step 5: Add an else statement to display the string "Keep writing code to accomplish something great!"
else {
  echo "Keep writing code to accomplish something great!";
}  

Thanks

1 Answer

Steven Parker
Steven Parker
231,007 Points

It looks like the line after the "Step 1" comment is missing a semicolon at the end.

sigh...Steve? It's the little things, I'll tell ya...:-)

Thanks!

Steven Parker
Steven Parker
231,007 Points

Indeed! Computers can be so picky! :wink:

Happy coding!