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 PHP Basics Getting to Know PHP Intro to Workspaces and PHP Code

Erin Brunken
Erin Brunken
8,490 Points

Workspaces printing entire code instead of just "Hello World" p> Instead of just "Hello World" when I run my code?

When I type in my code which is: <?p echo "Hello World"; ?>

Workspaces is returning all the above code back to me when I run the script instead of just the output of "Hello World".

3 Answers

Anusha Singh
PLUS
Anusha Singh
Courses Plus Student 22,106 Points

Well while writing php the workspaces, you do not write it like this:

<?p echo "hello world"; ?> this is wrong

<?php echo "hello world"; ?> this is correct

i am not sure but shouldn't it be

<?php echo "Hello World"; ?> 

instead of

<?p echo "Hello World"; ?>
Nathan Williams
seal-mask
.a{fill-rule:evenodd;}techdegree
Nathan Williams
Python Web Development Techdegree Student 6,851 Points

This is specifically due to a configuration option in php called "short_open_tags"; we explicitly disable it in workspaces, as it's not always supported, and the benefit for developers of making their code portable vastly outweighs the "convenience".