PHP Programs

PHP Program for If else statement

In this program we use if-else statement to check today is weekend or not.

If else are flow controls statement in which block of code execute only if condition satisfy or not.

Program

<html>

<head>

<title>IF...Else Example</title>

</head>

<body>

<?php

$d=date("D");

if($d=="fri")

    echo"Have a nice weekend!";

else

    echo"Have a nice day!";

?>

</body>

</html>

When Run The Program Following Output:

See In Following Window

Description

In above program if today is Friday that time it prints "Have a nice weekend!" If day is other than Friday then "Have a nice day will print on screen.

Releted Programs

© 2017 codewmAll rights reserved.