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 One Solution

Anastasia Khmelevskaya
Anastasia Khmelevskaya
1,775 Points

I did everything correct, same as the explanatory video, but kept getting a syntax error message in Console

My code: <?php

$hours = 40;

$productivity = 10.5;

$firstTotal = $hours * $productivity;

$hours++

$productivity-=.5;

$secondTotal = $hours * $productivity;

echo 'For example, if your original productivity accomplished is '; echo $firstTotal; echo ' and you add 1 hour, while at the same time subtracting .5 of productivity, your new productivity accomplished is only '; echo $secondTotal;

?>

The error message:

treehouse:~/workspace$ php index.php
PHP Parse error: syntax error, unexpected 'echo' (T_ECHO) in /home/treehouse/workspace/index.php on line 12
treehouse:~/workspace$ php index.php
PHP Parse error: syntax error, unexpected '$productivity' (T_VARIABLE) in /home/treehouse/workspace/index.php on line 12
treehouse:~/workspace$ php index.php
PHP Parse error: syntax error, unexpected '$productivity' (T_VARIABLE) in /home/treehouse/workspace/index.php on line 12

1 Answer

Simon Coates
Simon Coates
8,481 Points

does the missing semicolon make a difference?

$hours++;