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 trialMalin Spindel
154 PointsWhy does this not work? <?php $name = "Mike"; echo $name ; ?>
why does this not work?
1 Answer
Torger Angeltveit
11,228 PointsHi malin, There is nothing wrong with the code.
do you use a domain or have a fake hosting installed to read the php code?
Malin Spindel
154 PointsI deleted the spaces before the statements and then it was aprooved! wierd! But thank you for your answer!
Peter Ball
6,852 PointsPeter Ball
6,852 PointsI typed out exactly what you have entered above (<?php $name = "Mike"; echo $name; ?>) into a file called testit.php, then saved that page.
I then started XAMP (I am running windows)
I then accessed that page (testit.php) by using the URL address: http://localhost/testit.php
And got this output on the web page:-
Mike