2014-09-21

IF statement


Use the if statement to execute some code only if a specified condition is true. 

Syntax

if (conditioncode to be executed if condition is true;


The following example will output "Have a nice weekend!" if the current day is Friday:

<html>

<body>


<?php

$d=date("D");

if ($d=="Fri") echo "Have a nice weekend!";

?>


</body>

</html>


Notice that there is no ..else.. in this syntax. You tell the browser to execute some code only if the specified condition is true.

0 comments:

Post a Comment

Tools & Plugins

Blog Archive