How to use or operator in laravel

You can use or operator in laravel using || in if statement between two or more than two conditions. If statement will be executed if any one or more than one of these conditions evaluates true.

Answers 1
  • If statement with OR (||) condition in php

    $var = "abc";
    if($var == "abc" || $var == "def") 
        echo "true"; 

    It will return true if the value of $var is abc or def. If the value we assign to $var is not equal to “abc” or “def” then the if statement will not be executed.

  • Back to code snippet queries related laravel