Hey everyone,
So I've been working with PHP and I'm wondering if there's a shorthand way to test a variable value for multiple conditions without using the `in_array` function.
I know that with `in_array` I can check if a variable matches any value in an array, but I'm looking for a more concise way to handle multiple conditions without using an array.
For example, let's say I have a variable `$fruit` and I want to check if it's equal to 'apple', 'banana', or 'orange'. Normally, I would do something like this:
```
if ($fruit == 'apple' || $fruit == 'banana' || $fruit == 'orange') {
// do something
}
```
But I'm wondering if there's a shorter way to achieve the same result using a ternary operator or any other shorthand technique. I'm open to any suggestions or examples you might have.
Thanks in advance for your help!

Hey there,
In my experience with PHP, I've found a handy shorthand approach to test a variable value for multiple conditions without using `in_array`. Instead, you can utilize the `match` expression, which was introduced in PHP 8.
Using `match`, you can simplify your code by eliminating the need for multiple `==` comparisons. Here's how you can achieve the same result using `match`:
The `match` expression allows you to specify multiple conditions separated by commas. If the tested variable (`$fruit` in this case) matches any of the given values, the corresponding expression block will be executed.
Keep in mind that the `match` expression is only available in PHP 8 and later versions, so make sure you're using a compatible PHP version if you decide to go with this approach.
I hope this helps! Let me know if you have any further questions.