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 trialSufiyaan Haroon
Full Stack JavaScript Techdegree Student 9,558 PointsI don't get seven when I type $a++;
treehouse:~/workspace$ php numbers.php
PHP Parse error: syntax error, unexpected ';' in /home/treehouse/workspace/numbers.php on line 24
Parse error: syntax error, unexpected ';' in /home/treehouse/workspace/numbers.php on line 24
treehouse:~/workspace$
My code was:
<?php
$num_one = 1;
$num_two = 2;
$num_three = 3;
/*var_dump( $num_one );
var_dump( 1 );
var_dump( '1' );
var_dump( $num_one + $num_two - $num_three);*/
$distance_home = 1.2;
$distance_work = 2.5;
var_dump($distance_home + $distance_work + $num_three + .3);
$a = 5;
$b = 10;
var_dump($a * $b);
var_dump($a / $b);
$a = $a + 1;
var_dump($a);
$a++;
?>
4 Answers
Darryl Driedger
Full Stack JavaScript Techdegree Student 24,724 Pointsput var_dump($a); after your a++ and you will get your seven
Sean Flanagan
33,235 PointsI got caught out by this as well. It would have helped if Alena Holligan had shown the duplicated line on screen below the increment line.
Tsitsi Museza
2,601 Pointsyes i think if she had shown how she duplicated it would be easier
Angyal István
11,259 PointsTry one of them:
$a++;
$a += 1;
++$a;
$a = $a + 1;
But the problem maybe is that, You write the last value giver "$a++" after the "var_dump($a)", so the var_dump still contains the upper value of the $a.
I hope I can You!
DEKIMBE MURRAY
171 Pointsthis got me too - should have scrolled down to show we insert $a++ in between