This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Comparison operators allow us to compare values and yield the result. In this video we'll be looking at equal and identical comparisons. Equal compares ONLY the values while identical compares the values and type. We'll also consider type juggling in PHP.
Example
To assign the result of a comparison to another value, you would use:
$a = 10;
$b = "10";
$c = ($a == $b);
It is a good idea to use parentheses to be clear on evaluation.
Documentation
Learn about additional Comparison Operators
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up