loans
clickerwayne logo Toll Free: 1.888.94.WAYNE | PH 63.905.24.WAYNE | US 1.646.84.WAYNE

Learn PHP: If Else Elseif Statement

For these examples we will use the Comparison Operator === (triple equal sign) or Identical Operator. In Demo 1 the condition is returned TRUE because the the string value of the variable $user is identical to the string value of the variable $name or vice versa.


<?php

// Demo 1

  $user = "Jane Potter";
  $name = "Jane Potter";

  if($user === $name) {
    echo "True Values are identical";
  }else{
    echo "False Values are not identical";
?>

output: True Values are identical


Demo 2 the condition is returned FALSE as the string values of the variables $user and $name are NOT identical.

<?php

// Demo 2

  $user = "Jane Potter";
  $name = "Jan Potter";

  if($user === $name) {
    echo "True Values are identical";
  }else{
    echo "False Values are not identical";
?>

output: False Values are not identical


This time we have the elseif statement included on Demo 3. It returned FALSE because neither the if nor the elseif condition was met.

<?php

// Demo 3

  $userA = "Jane Potter";
  $userB = "Harry Potter";

  if($member === "$userA") {
    echo "Hello Jane Potter";
  }elseif($member === "$userB") {
    echo "Hi there Mr. Harry Potter";
  }else{
    echo "You are not a Potter";
  }
?>

output: You are not a Potter


LoansDito.com

Need Cash?

Why wait for hours or days when you can get yur Pre-Screening Result for eligibility to apply is just

48

seconds

Apply Now


Latest Videos

Latest Video Tutorials

Learn How To Code
A quick preview of Cli_Ent Systems version 4 ready to transition to a newer version ...
Robotic Process Automation
Sweetie, the Pinoy Assistive Bot of LoansDito.com for quicker and faster service ...
Cli</>Ent Systems
A Call Center System that was originally built using MS Excel then Google Sheets
Clickerwayne Logo

Clickerwayne.com © 2010-2020. All Rights Reserved