Mega Code Archive

 
Categories / Php / Statement
 

A helpful addition to if statements is the elseif statement, which allows you to chain conditions together in a more intelligent

<?php             if ($Age < 10) {                     print "You're under 10";             } elseif ($Age < 20) {                     print "You're under 20";             } elseif ($Age < 30) {                     print "You're under 30";             } elseif ($Age < 40) {                     print "You're under 40";             } else {                     print "You're over 40";             }     ?>