Pages

Saturday, August 27, 2011

PHP If...Else


Use the if....else statement to execute some code if a condition is true and another code if a condition is false.

Syntax

if (condition)
  code to be executed if condition is true;
else
  code to be executed if condition is false;

For Example :

<html>
<body>

<?php
$d=date("D");
if ($d=="Fri")
  echo "Have a nice weekend!";
else
  echo "Have a nice day!";
?>

</body>
</html>


Let Try.....

No comments:

Post a Comment