PHP PHP Basics Daily Exercise Program True PHP

Nicholas Chetto
Nicholas Chetto
4,221 Points

pretty sure the system is funky out or I'm just doing it wrong but I know I'm close anyone help please?.

Create a new variable name $isIdentical. Compare the variable $a as equal and of the same type as the string "5" and assign the results to $isIdentical.

index.php
<?php
$a = 5;
//Place your code below this comment
$isBoolean = true;
$isIdentical = "5";
var_dump($a == $isIdentical);
?>

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 144,853 Points

Hi Nicholas,

You are on the right track and have all the pieces, there are just couple things out of place and one small error.

First, the challenge does not ask for a vardump(), so that line needs to be deleted. Instructions are very specific and if not followed explicitly, the task will always return a Bummer even if code is correct.
The Instruction want the comparison asked for to be stored in the variable $isIdentical, but you are hard-coding a value there instead.

Second, the instructions do state that it wants a comparison to be equal and same type (===), but you are only checking for equal (==).

Because you do have all the correct code (once the == is changed to ===), I have provide the corrected code snippet for the challenge for you to review with the above notes.

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

Hopes this helps to clear things up. :)

Keep Coding! :dizzy:

Andres Ramirez
Andres Ramirez
17,240 Points

Hi Nicholas,

I was struggling with this answer as well. I don't remember anywhere in the videos using two equalities in the same line. Where can I find this explained more in detail?

Thanks!