View Single Post
  #9 (permalink)  
Old 04-18-2008, 03:25 AM
senraj senraj is offline
D-Web Master
 
Join Date: Jul 2007
Posts: 418
senraj is on a distinguished road
Post Re: Operations in PHP

Hi,



Control statements are fundamental to programming languages. Control statements permit you to take some action if something is the case, and different action (or no action) otherwise. There are three common control statements in PHP:

if . . . else: As the words suggest, this statement tests if something is true. If it is, then it does one thing, else it does another thing. The else part can be omitted. For example,

PHP Code:
      $IP_address getenv("REMOTE_ADDR");
      if ( 
$IP_address == "121.114.221.111" ) {
        echo 
"Hello, George.  Welcome to my web site.");
      }
      else {
        echo 
"Howdy, stranger.";
      }

      
$temperature 71;
      if ( 
$temperature >= 50 ) {
        echo 
"Nice day!";
      } 
__________________
Regards,
Senraj.A
Reply With Quote