What are some alternative ways in PHP to check if a value is in a list without using a long chain of "or" statements?

When checking if a value is in a list in PHP, using a long chain of "or" statements can be cumbersome and inefficient. An alternative approach is to use the in_array() function, which checks if a value exists in an array. This function simplifies the code and makes it easier to maintain.

// Define the list of values
$list = ['apple', 'banana', 'orange', 'pear'];

// Value to check
$value = 'banana';

// Check if the value is in the list
if (in_array($value, $list)) {
    echo "Value is in the list";
} else {
    echo "Value is not in the list";
}