How to use or operator in laravel

Updated at 19-Sep-2021, By samar

How to use or operator in laravel

With this article, we’ll look at some examples of how to address the "How to use or operator in laravel" problem.

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.
  • 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