Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
STAFF
.a{fill-rule:evenodd;}techdegree
Nathan Williams
Treehouse Staff

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".