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 (Retired) PHP Data & Structure Order of Operation

The greater picture reason behind the naming and renaming "Mike the Frog" inside the PHP code block?

I was watching the video with Hampton in which he assigns and reassigns the name of the website mascot "Mike the Frog" 3 different times:

<?php
$name = "Mike";
$full_name = "Mike the Frog";
$name = $full name;
?>

This seemed unnecessary and excessive...why not just name the variable name that we want once vs. this shenanigans? I get that he was trying to explain that PHP reads from the top downward, but I feel like this is a strange way to explain that concept...is there a time when in PHP we'll need to assign and reassign something like this over and over? I feel like perhaps there's a greater picture meaning behind what he did that I didn't see from his video...maybe not, but I thought it's worth an ask.

1 Answer

Julian Gutierrez
Julian Gutierrez
19,201 Points

Like you said it seems like Hampton is just trying to explain how php reads code from top down or "order of operations".