How to use or operator in laravel

Created at 20-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

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.