LonghornPHP 2026

Voting

: min(zero, seven)?
(Example: nine)

The Note You're Voting On

techguy14 at gmail dot com
15 years ago
You can have 'nested' if statements withing a single if statement, using additional parenthesis.
For example, instead of having:

<?php
if( $a == 1 || $a == 2 ) {
    if( $b == 3 || $b == 4 ) {
        if( $c == 5 || $ d == 6 ) {
             //Do something here.
        }
    }
}
?>

You could just simply do this:

<?php
if( ($a==1 || $a==2) && ($b==3 || $b==4) && ($c==5 || $c==6) ) {
    //do that something here.
}
?>

Hope this helps!

<< Back to user notes page

To Top