How does php determine whether the URL or string contains a value in the array?

how does php determine whether the URL or string contains a value in the array? For example, in the following code, when the "Android" in the array is placed in the first position (that is, in front of the character "filter"), the normal return value is 1, but when the "Android" in the array is placed in the second or later position, the return value is set to 0, but the desired result is to return 1 as long as the array contains the value of "Android". How to modify the code?

<?php
header("Content-Type: text/html; charset=UTF-8");
$arr=array("","","");//,
$str="";
foreach($arr as $key){
    if(strstr($str,$key)){//.str,.
        echo 1;
        exit;
    }else{
        echo 0;
        exit;
    }
}
?>
Php
Mar.26,2022

$arr = [];
$str = '';
$result = 0;
foreach($arr as $item){
    if(strpos($str,$item)!==false){
        $result = 1;
        break;
    }
}

echo $result;
Menu