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 DATA AND STUCTURE

Create a PHP Code Block with a Variable called "name" inside of that block and set it equal to "Mike".

Dont understand

2 Answers

Hi Lyric, the answer is fairly simple. It includes the opening and closing PHP tags, the variable $name, and it's asking you set it equal to Mike.

<?php 

$name = "Mike";

?>

can anyone tell me why you would want to declare the variable inside the code block. The video shows a declaration at the top of the page and then calling the variable inside the code block but then the challenge has you declare it right inside the code block.

If I understand correctly, is this is the same thing?

$name="Mike";

<?php echo $name ?>