FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » AND in the if statement
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: AND in the if statement [message #171235 is a reply to message #171234] Wed, 29 December 2010 19:42 Go to previous messageGo to previous message
Mike is currently offline  Mike
Messages: 18
Registered: December 2010
Karma:
Junior Member
Basic... is there (still) such a thing?

if( $a==1 && $b==2) { // do some cool stuff }

If you use a single =, you'll actually set the value and it'll always
be true. the double == checks equality without changing the value.
Use || for OR.

Mike
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: php-debug-faq-post in progress
Next Topic: using same variable twice on same page
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 11:39:40 GMT 2024

Total time taken to generate the page: 0.04683 seconds