Return true if haystack contains needle.

@param string $haystack   The string to check for needle existence.
@param string $needle     The string to find in the haystack.
@param bool   $ignoreCase Set to true to ignore case.

@return bool
324604
public static function contains($haystack, $needle, $ignoreCase = false)
    {
        if ($ignoreCase) {
            $needle = strtolower($needle);
            $haystack = strtolower($haystack);
        }
        $pos = strpos($haystack, $needle);

        return !($pos === false);
    }
568917
public static function startWith(string $haystack, string $needle): bool
    {
        return ($needle === mb_substr($haystack, 0, mb_strlen($needle, 'UTF-8'), 'UTF-8'));
    }
1340777
public static function contains( $haystack, $needles )
    {
        foreach ( ( array ) $needles as $needle )
        {
            if ( '' !== $needle && FALSE !== strpos( $haystack, $needle ) )
            {
                return TRUE;
            }
        }

        return FALSE;
    }
1058277
public static function startsWith(
        string $haystack,
        string $needle,
        $caseSensitive = true
    ) : bool {
        $fName = $caseSensitive ? 'strpos' : 'stripos';

        return $fName($haystack, $needle) === 0;
    }
433026
public static function startsWith($needle, $haystack, $caseSensitive = true)
    {
        if (!self::isValid($needle)) {
            return false;
        }

        list($needle, $haystack) = self::transformCase($needle, $haystack, $caseSensitive);

        if ($needle === false) {
            return false;
        } else {
            return (self::substring($haystack, 0, self::length($needle)) === $needle);
        }
    }
426322
public static function startsWith($haystack, $needle, $ignoreCase = false)
    {
        if ($ignoreCase) {
            return stripos($haystack, $needle) === 0;
        } else {
            return strpos($haystack, $needle) === 0;
        }
    }
491966
private function startsWith($haystack,$needle,$case=true)
    {
        if($case)
            return strpos($haystack, $needle, 0) === 0;
        return stripos($haystack, $needle, 0) === 0;
    }
154663
protected function isStartWith($haystack, $needles) {
        if (!is_array($needles)) {
            $needles = array($needles);
        }
        foreach ($needles as $needle) {
            if (substr($haystack, 0, strlen($needle)) === $needle) {
                return true;
            }
        }
        return false;
    }
853922
public static function contains($haystack, $needle)
    {
        // Check arguments
        if (empty($haystack) || empty($needle)) {
            return false;
        }

        // Needle is string
        if (!is_array($needle)) {
            return mb_strpos($haystack, $needle) !== false;
        }

        // Needle is array, check if haystack contains all items
        foreach ((array)$needle as $str_needle) {
            if (!empty($str_needle) && mb_strpos($haystack, $str_needle) === false) {
                return false;
            }
        }

        return true;
    }
649501
public static function startsWith($haystack, $needle)
    {
        if (strlen($haystack) < strlen($needle)) {
            return false;
        }
        $start = substr($haystack, 0, strlen($needle));

        return $needle === "" || $needle === $start;
    }
138235
public static function contains($haystack, $needle)
    {
        foreach ((array)$needle as $n) {
            if (strpos($haystack, $n) !== false) {
                return true;
            }
        }

        return false;
    }
1325767
public function ends_with( $haystack, $needle ) {
		if ( '' === $haystack || '' === $needle ) {
			return false;
		}
		if ( $haystack === $needle ) {
			return true;
		}

		return substr_compare( $haystack, $needle, - strlen( $needle ) ) === 0;
	}
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);
	}
991230
public function match($needle, $haystack)
    {
        $len = strlen($needle);

        /** @noinspection SubStrUsedAsStrPosInspection */
        return $len === 0 || substr($haystack, 0, $len) === $needle;
    }
187255
protected function string_contains( $haystack, $needles ) {
		foreach ( (array) $needles as $needle ) {
			if ( '' !== $needle && mb_strpos( $haystack, $needle ) !== false ) {
				return true;
			}
		}

		return false;
	}
1180209
public static function containsOneOf($haystack, array $needles)
    {
        foreach ($needles as $needle) {
            if ($needle !== '' && mb_strpos($haystack, $needle) !== false) {
                return true;
            }
        }

        return false;
    }
1264102
public static function endsWith(
        string $haystack,
        string $needle,
        bool $caseSensitive = false
    ): bool
    {
        $test = substr($haystack, -strlen($needle));
        return ($caseSensitive === false)
            ? strcasecmp($test, $needle) === 0
            : strcmp($test, $needle) === 0;
    }