RsD0p9BK
3/11/2016 - 8:41 AM

in_string.php

// поиск в строке (strpos)
function in_string($haystack, $needle) {

    if (is_array($needle)) {
        foreach ($needle as $n) {
            if (mb_strpos($haystack, $n) !== false) return true;
        }
    } 

    else return mb_stripos($haystack, $needle) !== false;
}

// поиск в строке (stripos)
function in_istring($haystack, $needle) {

    if (is_array($needle)) {
        foreach ($needle as $n) {
            if (mb_stripos($haystack, $n) !== false) return true;
        }
    } 

    else return mb_stripos($haystack, $needle) !== false;
}