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

Luke Pettway
Luke Pettway
16,555 Points

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') ?>