How can the use of strpos() in PHP be advantageous for searching for values in a list compared to in_array()?

When searching for values in a list in PHP, using strpos() can be advantageous compared to in_array() because strpos() allows for more flexibility in searching for a specific value within a string. strpos() returns the position of the first occurrence of a substring within a string, which can be useful for searching within larger strings or arrays. In contrast, in_array() is more suited for checking if a specific value exists in an array.

$list = ['apple', 'banana', 'cherry', 'date'];
$searchValue = 'banana';

foreach ($list as $item) {
    if (strpos($item, $searchValue) !== false) {
        echo "Found $searchValue in the list!";
        break;
    }
}