Yii Framework Forum: comparing diference - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

comparing diference Rate Topic: -----

#1 User is offline   zipzap 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 314
  • Joined: 13-January 12

Posted 08 March 2012 - 04:33 PM

what's the difference between 2 equals and 3??

if (x==y) and if (x===y)
0

#2 User is offline   jrn 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 104
  • Joined: 03-October 11
  • Location:Los Angeles

Posted 08 March 2012 - 04:36 PM

The php.net website gives you a pretty good overview on possible comparison operators.
0

#3 User is offline   zipzap 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 314
  • Joined: 13-January 12

Posted 08 March 2012 - 04:38 PM

thanks
0

#4 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,349
  • Joined: 12-October 09
  • Location:Croatia

Posted 08 March 2012 - 05:09 PM

NOTE: moved to proper section (General PHP Topics instead of General Discussion for Yii 1.1.x)
Find more about me.... btw. Do you know your WAN IP?
0

#5 User is offline   onkar lal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 13-September 11
  • Location:India

Posted 14 May 2012 - 02:38 AM

View Postzipzap, on 08 March 2012 - 04:33 PM, said:

what's the difference between 2 equals and 3??

if (x==y) and if (x===y)


The operator "==" checks only the values if they are equal instead of having different types Like
if(True == 1) will return true by the operator "==" because True is Boolean and 1 is binary while True reefers to 1 in binary.

While "===" operator checks for the type also. Like
if(True === 1) will return false because both types are not same.

So use of operator == and === depends on the requirement basis.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users