Conditional Statements : Conditional Operator « Operator « PHP






Conditional Statements

 
<?php
            $Age = 20;
            if ($Age < 18) {
                    print "You're young - enjoy it!\n";
            } else {
                    print "You're not under 18\n";
            }

            if ($Age >= 18 && $Age < 50) {
                    print "You're in the prime of your life\n";
            } else {
                    print "You're not in the prime of your life\n";
            }

            if ($Age >= 50) {
                    print "You can retire soon - hurrah!\n";
            } else {
                    print "You cannot retire soon :( ";
            }
    ?>
  
  








Related examples in the same category

1.The trinary operator
2.Conditional Operator
3.Less-than and greater-than