Returns information if one string contains another string

@param string $haystack The string to search in
@param string $needle   The string to be search for
@return bool
483320
public static function contains($haystack, $needle)
    {
        if (1 === strlen($needle) && !self::isLetterOrDigit($needle)) {
            $needle = '\\' . $needle;
        }

        return (bool)preg_match('|.*' . $needle . '.*|', $haystack);
    }
982161
public function startswith(string $haystack, string $needle) : bool
    {
        return (substr($haystack, 0, strlen($needle)) === $needle);
    }
1285782
public static function startsWith($haystack, $needle) {
		if($needle === null && $haystack === null)
			return false;
		if($needle === null && $haystack !== null)
			return true;
		return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
	}
417654
public static function stringEndsWith($haystack, $needle)
    {
        if (substr($haystack, - strlen($needle)) === $needle) {
            return true;
        }

        return false;
    }
1010896
public static function  endsWith( $haystack , $needle )
	{
		return $needle === "" || ( ( $temp = strlen( $haystack ) - strlen( $needle ) ) >= 0 && strpos( $haystack , $needle , $temp ) !== false );
	}
975820
public static function arraySearchGetValue($needle, array $haystack)
    {
        $lcNeedle = strtolower($needle);

        foreach ($haystack as $value) {
            if ($lcNeedle == strtolower($value)) {
                return $value;
            }
        }

        return null;
    }
947384
public static function contains($haystack, $needle, $caseSensitive = true)
    {
        return ($caseSensitive ? strpos($haystack, $needle) : stripos($haystack, $needle)) !== false;
    }
1155251
public static function endsWith($haystack, $needle) {
		if($needle === null && $haystack === null)
			return true;
		if($needle === null && $haystack !== null)
			return true;
		return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
	}
801148
protected function wasDispatched($needle, array $haystack)
    {
        foreach ($haystack as $dispatched) {
            if ((is_string($dispatched) && ($dispatched === $needle || is_subclass_of($dispatched, $needle))) ||
                $dispatched instanceof $needle) {
                return true;
            }
        }

        return false;
    }
1291942
public static function words_match($haystack, $needle)
    {
        $a_needle  = self::tokenize_string($needle, 1);
        $_haystack = join(" ", self::tokenize_string($haystack, 1));
        $valid     = strlen($_haystack) > 0;
        $hits      = 0;

        foreach ($a_needle as $w) {
            if ($valid) {
                if (stripos($_haystack, $w) !== false) {
                    $hits++;
                }
            }
            else if (stripos($haystack, $w) !== false) {
                $hits++;
            }
        }

        return $hits >= count($a_needle);
    }
1190505
public function beginsWith(string $haystack, string $needle): bool
    {
        return (!empty($needle) && 0 === strpos($haystack, $needle));
    }
30804
public static function isNeedlesExists($haystack, $needles) {
        foreach($needles as $needle) {
            if(stripos($haystack, $needle)!==false){
                return true;
            }
        }
        return false;
    }
244934
public function arraySearch($needle, $haystack)
    {
        if (empty($needle) || empty($haystack)) {
            return false;
        }

        foreach ($haystack as $key => $value) {
            $exists = 0;
            foreach ($needle as $nkey => $nvalue) {
                if (!empty($value[$nkey]) && $value[$nkey] === $nvalue) {
                    $exists = 1;
                } else {
                    $exists = 0;
                }
            }

            if ($exists) {
                return $key;
            }
        }

        return false;
    }
242331
public static function endswith($haystack, $needle) {
    $haylen  = strlen($haystack);
    $needlelen = strlen($needle);
    if ($needlelen > $haylen)
      return false;

    return substr_compare($haystack, $needle, -$needlelen) === 0;
  }
1202321
public static function hasAnyKey(array $haystack, ...$needles)
    {
        foreach ($needles as $needle) {
            if (array_key_exists($needle, $haystack)) {
                return true;
            }
        }

        return false;
    }
1043630
public static function containsCaseless($haystack, $needles)
    {
        foreach ((array) $needles as $needle) {
            $needle = preg_quote($needle);
            if ($needle != '' && preg_match("/$needle/iu", $haystack)) {
                return true;
            }
        }

        return false;
    }
568917
public static function startWith(string $haystack, string $needle): bool
    {
        return ($needle === mb_substr($haystack, 0, mb_strlen($needle, 'UTF-8'), 'UTF-8'));
    }