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.

Related Posts:

  • Nested if statementUse the if....elseif...else statement to select one of several blocks of code to be executed. Syntax if (condition) code to be executed i… Read More
  • IF statement.code .code-area{width:auto; min-height:25px; border-left:2px solid #d503a1; background:#fafafa; padding-left:3px; margin:-13px 0; margin-left:-2px; f… Read More
  • PHP If...Else Statementsv\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} Norma… Read More

0 comments:

Post a Comment

Tools & Plugins

Blog Archive