Sunday 9 June 2013

IF ELSE STATEMENT IN PHP

This post explains how to use the if else clause in php. The if else clause in php is exactly similar to the if else of C and C++.
/******************************************************************************/
<html>
                <head>
                                <title>constants</title>
                </head>
                <body>
                                <?php
                                                $a=10;
                                                $b=15;
                                                if($a>$b)
                                                                echo"a is greater than b";
                                                else
                                                                echo"b is greater than a";
                                ?>
                </body>

</html>
/*****************************************************************************/

If the logical expression in the if clause evaluates to true then the statement in the if block will be executed otherwise the statements included in the else clause will be executed.

No comments:

Post a Comment