Pages

Saturday, August 27, 2011

The if Statement Of PHP


The if Statement Of PHP

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

Syntax :

if (condition) code 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 day!";
?>

</body>
</html>



No comments:

Post a Comment