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

i am not sure but shouldn't it be

<?php echo "Hello World"; ?> 

instead of

<?p echo "Hello World"; ?>
Anusha Singh
PRO
Anusha Singh
Pro 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

Nathan Williams
STAFF
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".