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

LOUIE MANGARING
LOUIE MANGARING
1,897 Points

How to solve challenge task 2 of 2 in PHP basics?

Please help me answer this task as I am having trouble to understand the question. Thank you.

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

$booleanOne = true;
var_dump($booleanOne);

$booleanTwo = var_dump($a == $string);


?>
Tibor Katai
Tibor Katai
2,102 Points

Use the === equal sign!

2 Answers

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

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

For part 2, the challenge wants to you create a new variable named $booleanTwo, it's also a Boolean whose value is assigned by comparing whether $a (defined in line 2) equals to String "5".

<?php
$a = 5;
//Place your code below this comment
$booleanOne = true;       // part 1

$booleanTwo = $a == "5";  // part 2
?>

Hope it helps.

$a = 5;
//Place your code below this comment
$booleanOne = true;       // part 1

$booleanTwo = ($a === "5");  // part 2
?>