Jump to content


Photo

if statements


  • Please log in to reply
3 replies to this topic

#1 Immortal55

Immortal55
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 17 March 2006 - 12:58 AM

Is it possible to place an IF statement in an IF statement?

#2 Steveo31

Steveo31
  • Members
  • PipPip
  • Member
  • 25 posts
  • LocationSan Jose, CA

Posted 17 March 2006 - 01:02 AM

Like...

if(..){
   if(...){

   }
}

Yea sure.

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 March 2006 - 01:02 AM

[!--quoteo(post=355758:date=Mar 17 2006, 12:58 AM:name=Immortal55)--][div class=\'quotetop\']QUOTE(Immortal55 @ Mar 17 2006, 12:58 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Is it possible to place an IF statement in an IF statement?
[/quote]

yes called nesting


<?php
   do {
       if( ! $condition_1 ) break;
           // something
       if( ! $condition_2 ) break;
           // etc

   } while ( FALSE );
?> 

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 Steveo31

Steveo31
  • Members
  • PipPip
  • Member
  • 25 posts
  • LocationSan Jose, CA

Posted 17 March 2006 - 01:06 AM

Personally I think case/switches are easier than do/while.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users