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 Daily Exercise Program True PHP

Victoria Loisi
Victoria Loisi
7,070 Points

"I cannot see a variable named $booleanTwo" error when it is right there?

This is the assignment: Create a new variable name $booleanTwo. Set $booleanTwo equal to the result of comparing the variable $a as IDENTICAL to the string "5".

This was my first part, with the first assignment, that was ok:

$a = 5;

//Place your code below this comment

$booleanOne = TRUE;

And now, I've completed it, so it is like this:

$a = 5;

//Place your code below this comment

$booleanOne = TRUE;

$booleanTwo = var_dump($a === "5");

echo $booleanTwo;

As it kept saying to me that he couldn't see the $booleanTwo variable, I added an echo, but I still get the error. What am I doing wrong?

4 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Close, but not quite! To pass this, you only need to add two lines of code to the code that was there from the beginning. It's not so much that your code isn't functional, but it doesn't meet the requirements of the challenge. You've gone a bit overboard here. It's always best to not do something a challenge doesn't explicitly ask for. For example, the instructions say nothing of a var_dump or an echo. Even if functional, it can cause the challenge to fail because it's not the exact thing they're looking for. Take a look:

This is the line you need for the second step:

$booleanTwo = $a === "5";

Hope this helps! :sparkles:

Bernardo Leal
Bernardo Leal
5,715 Points

Problem is, the error message is misleading. It happens on quite a few challenges.

Victoria Loisi
Victoria Loisi
7,070 Points

You're right! Thanks for the advice as well!!

Robbie Thomas
Robbie Thomas
31,093 Points

Had some troubles with this one myself.