PHP PHP Basics Daily Exercise Program True PHP

I don't really understand it

I don't really understand what the task wants from me. Can someone help pls?

index.php
<?php
$a = 5;
//Place your code below this comment
$isBoolean = true;

$isIdentical = '5';

var_dump($a == $isIdentical);


?>

"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."

2 Answers

I think the answer here is:

$isIdentical = ($a === "5")

So first you need to check if $a and the string "5" is equal + of the same type (using something like ===). Then you need to assign the answer of that into $isIdentical

Haven't actually watched this video yet, but you could give it a shot ?

Thank you so much Sinead! (you don't know how I'm happy right now haha)

M Glasser
M Glasser
10,868 Points

Got stuck here as well! Realizing now that var_dump() is a function that returns the kind and value of whatever is passed into the parentheses (a.k.a. arguments). So, $isIdentical effectively gets declared as a boolean variable once the strict comparison operator is used in Sinead's example. If we take a var_dump on $isIdentical (sorry couldn't resist) then it should return "boolean(false)" to the console since it's purpose is to "dump" information about the variable. In this case we have a variable that is a boolean and it's value is false. More about var_dump here: http://php.net/manual/en/function.var-dump.php