PHP

Compare string by array

function stristr_array($string, $needleArray) {
    if (!is_array($needleArray)) {
        return false;
    }
    if (is_array($needleArray) && count($needleArray)) {
        foreach ($needleArray as $needle) {
            if (stristr($string, $needle)) {
                return $needle;
            }
        }
    }
}
function strstr_array($string, $needleArray) {
    if (!is_array($needleArray)) {
        return false;
    }
    if (is_array($needleArray) && count($needleArray)) {
        foreach ($needleArray as $needle) {
            if (strstr($string, $needle)) {
                return $needle;
            }
        }
    }
}