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

php help me ?????

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

Please help me

index.php
<?php
$a = 5;
$booleanOne = true;
$booleanTwo = $a == '5')
?>

2 Answers

There are two ways to check a value in PHP

== results in an non-strict comparison (or similar). What that means is the number 2 and the string '2' are technically both equal even though one is a number and one is a string.

=== is a strict comparison (or identical comparison). If you compare the number 2 to the string '2' then it would result in the values not being equal.

The key to solving your problem lies in the word (IDENTICAL). Use the above information to look at your problem again and then let me know if you solved it!

Adrian Bogdan Grijincu
Adrian Bogdan Grijincu
2,819 Points

<?php $a = 5; $booleanOne = true; $booleanTwo = $a === '5') ?>