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 trialKumbirai Ruth Huni
4,209 Pointsrunning the php in console
Hi, after saving the file the variable name is still showing in console where could I be getting it wrong
3 Answers
f lsze
8,021 PointsHello, the error is that the variable you are echoing is using a hyphen $num-one
while the one that you set uses an underscore $num_one
. Ensure they are the same and give it another try : )
f lsze
8,021 PointsPlease paste your code here so we could take a look. Keep in mind that in the console since you did not specify a new line character, the variable shows up right BEFORE the "treehouse:~/workspace$" prompt.
Kumbirai Ruth Huni
4,209 Points<?php
$num_one = 1;
$num_two = 2;
$num-three = 3;
echo $num-one;
?>
f lsze
8,021 Pointsf lsze
8,021 PointsIn fact, hyphens are not allowed in variable names at all. So you should change
$num-three
to$num_three
. Also it appears you added a space between<?
andphp
, there can be no space, it has to be<?php
.Kumbirai Ruth Huni
4,209 PointsKumbirai Ruth Huni
4,209 Pointsthank you very much got it right this time