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

Create a new variable name $isIdentical. Compare the variable $a as identical (equal AND of the same type) as the string

I keep getting the error message Oops! It looks like Task1 is no longer passing.

I've tried several different methods. My current code is:

$isIdentical = "true";
$a = 5;
$booleanOne= $a ==="5";

What am I doing wrong... Please help!

2 Answers

Jason Anders
Jason Anders
Treehouse Moderator 145,858 Points

Hi Leanne,

You are more or less on the right track, but there seems to be a few things going wrong here. First, a good note to remember is that instructions for challenges need to be followed exactly as they are written.

With that in mind, the first thing is I no longer see the comment that was there that instructed you to:

//Place your code below this comment

You have some code that is out-of-place and may crash the challenge.

Second, you have created a variable $booleanOne that was not asked for, so this will need to be deleted.

Third, the instructions asked for the boolean true to be assigned to $isBoolean, but you have assigned the String "true", and also to the wrong variable.
Note: once you add quotation marks, everything inside the quotes becomes a string.

Finally, the result of the comparison needs to be stored in the variable $isIdentical.

I don't normally post the correct solution, but I feel with the above explanations, seeing the corrected code will be of the most learning benefit.

$a = 5;
//Place your code below this comment
$isBoolean = true;
$isIdentical = $a === "5";

I hope this helps. Keep Coding! :) :dizzy:

Hi Jason, Thank you... I learn best from seeing the correct code. After trying several ways of working it out myself and watching the video back a few times I decided to look at other solutions on the forum. I think the code that I ended up with was an incorrect solution from another forum. This looks a lot more like what I'd originally written. I think where I was going wrong was the == as it needs to be a ===. I'm sure I'll get my head fully around this eventually. Probably when I've forgotten to debug as I'm going along and broken something that will take me hours to fix ;-) Again... Thanks for your help. Much appreciated! Regards Leanne

Thanks for the help was having problems in comparing the the String variable because I was creating a variable that was not being asked for.