if === syntax

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Prints
Forum Newbie
Posts: 1
Joined: Thu Sep 10, 2009 8:11 am

if === syntax

Post by Prints »

Hi, I'm trying to trace a bug in osCommerce 3, but it uses "===" in many of it's if statements. What is the behaviour of "==="? I see it first time and php manual doesn't mention it.

Is it's functionality same as "=="?
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: if === syntax

Post by Mark Baker »

It's the same as == but with a little bit more, it actually compares the datatype as well as the datavalue

if (0 == 0.0) //compares an integer to a float, will return true
if (0 === 0.0) //compares an integer to a float, will return false

And the PHP manual mentions it plenty if you look
Post Reply