If Else Statement

If Else Statement

Example 1 : 

<?php if(strpos($_SERVER['HTTP_USER_AGENT'],"MSIE") !== FALSE) { ?>
<b>You are using Internet Explorer</b>
<?php } else { ?>
<b>You are not using Internet Explorer</b>
<?php } ?>

Example 2

<?php

    $marks = 95;

    if($marks <= 40 ) {

        echo 'You Failed';

    } elseif ($marks <= 59 && $marks >= 41) {

        echo 'Second Division';

    } elseif ($marks <= 74 && $marks >= 60) {

        echo 'First Division';

    } elseif ($marks <= 75 && $marks >= 79) {

        echo 'Distinction';

    } elseif ($marks <= 80 && $marks >= 89) {

        echo 'Great Marks';

    } elseif ($marks <= 94 && $marks >= 90) {

        echo 'Excellent Marks';

    } elseif ($marks <= 100 && $marks >= 95) {

        echo 'Outstnading Marks';

    }


?>

Loading ...

Related Results :

  1. If Else Statement
Note :
  • Related Posts are generally User Blog posts.
  • or Other tutorials from other networks of w3clan.com.
  • Any registered user can create related posts based on search term tags.

About the Author