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 trialJohn Hartney
2,893 PointsI dont get this, am I missing somthing?
var_dump( $a == $b); // equal
var_dump( $a == $d); // identical
var_dump( $a != $b); // not equal
var_dump( $a !== $b); // not identical
I am getting false no matter what I chose
3 Answers
Hugo Paz
15,622 PointsHi John,
Identical uses triple equal signs ===
I you look at your examples, non identical is not the same as non equal, it has an extra equal. You should update your example so identical uses triple equals.
David Tonge
Courses Plus Student 45,640 Points=== comparison operator is for something being identical. It's called a strict equality operator.
Example:
"Hello" == "HEllo" ... is true but "Hello" === HEllo" is false
John Hartney
2,893 PointsHay dave,
gave "Best Answer" to Hugo he was the first but I appreciate you example, thanks a bunch. : )
David Tonge
Courses Plus Student 45,640 PointsNo prob.
Stephen Van Delinder
21,457 PointsHugo is exactly right,
== means equal === means identical
This is due to typecasting in PHP. Identity comparisons (===) ensure that equal values are of the same type. Equality comparisons (==) just tests value.
For example:
0 == FALSE would resolve to true because FALSE is the boolean equivalent value to integer 0.
Conversely: 0 === FALSE would resolve to false because integers are not identical to boolean values.
Hope that helps.
John Hartney
2,893 PointsThat makes a lot of sense & thanks to all...
I wish I could get this kind of help with this post, I paused my account as I could not work out why the Carousel is not working and my wife needs this site for her e-portfolio
John Hartney
2,893 PointsJohn Hartney
2,893 PointsThanks Hugo,
my new glasses are causing me to make so many mistakes and resizing the treehouse videos is less than perfect, anyone got a spare set of eyes going cheap? lol