确定给定的字符串是否以给定的子字符串结束

@param  string       $haystack
@param  string|array $needles
@return bool
509338
public function endsWith( $needles ) : bool
    {
        foreach( (array)$needles as $needle ){
            if( substr( $this->__toString(), - strlen( $needle ) ) === (string)$needle ){
                return true;
            }
        }
        return false;
    }
794565
public static function exists(SimpleXMLElement $needle, SimpleXMLElement $haystack){
        foreach($haystack as $item){
            if($item->asXML() == $needle->asXML())
                return true;
        }
        return false;
    }
1051468
static public function endWith($haystack, $needle)
    {
        if (substr($haystack, -strlen($needle)) === (string) $needle) {
            return true;
        }

        return false;
    }
811711
protected function tagSearch($needle, array $haystack)
    {
        foreach ($haystack as $actual) {
            if (0 === strcasecmp($needle, $actual)) {
                return $actual;
            }
        }

        return null;
    }
801334
public static function containsAll(string $haystack, array $needles, bool $strict = true, string $encoding = null) : bool
    {
        return static::contains($haystack, $needles, true, $strict, $encoding);
    }
199271
public function endsWith(string $haystack, string $needle): bool
    {
        $escaped = preg_quote($needle);

        return (bool) preg_match("/$escaped$/", $haystack);
    }
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;
    }
1219199
private function strlikeInArray($needle, array $haystack):bool
    {
        foreach ($haystack as $one => $value) {
            if (preg_match("/$value/", $needle) === 1) {
                return (true);
            }
        }
        return (false);
    }
1125959
public static function search ($needles, array $haystack, & $key = "", array & $stack = [], $strict = false)
		{
			if (!is_array($needles))
			{
				$needles = [$needles];
			}
			if ($strict)
			{
				foreach ($needles as $needle)
				{
					if ($needle === $haystack)
					{
						$stack[] = $key;

						return $stack;
					}
					foreach ($haystack as $k => $hay)
					{
						if ($needle === $hay)
						{
							$key .= "." . $k;
							$stack[] = $key;
						}
						elseif (is_array($hay))
						{
							$tmpKey0  = $key . "." . $k;
							$tmpStack = static::search($needle, $hay, $tmpKey0, $stack, $strict);
							if (count($tmpStack) >= count($stack))
							{
								$stack = $tmpStack;
							}
						}
					}
				}
			}
			else
			{
				foreach ($needles as $needle)
				{
					if ($needle == $haystack)
					{
						$stack[] = $key;

						return $stack;
					}
					foreach ($haystack as $k => $hay)
					{
						if ($needle == $hay)
						{
							$key .= "." . $k;
							$stack[] = $key;
						}
						elseif (is_array($hay))
						{
							$tmpKey0  = $key . "." . $k;
							$tmpStack = static::search($needle, $hay, $tmpKey0, $stack);
							if (count($tmpStack) >= count($stack))
							{
								$stack = $tmpStack;
							}
						}
					}
				}
			}

			return $stack;
		}
483320
public static function contains($haystack, $needle)
    {
        if (1 === strlen($needle) && !self::isLetterOrDigit($needle)) {
            $needle = '\\' . $needle;
        }

        return (bool)preg_match('|.*' . $needle . '.*|', $haystack);
    }
1065592
private function arrayObjectContains(DependencyNode $needle, ArrayObject $haystack)
    {
        foreach ($haystack as $node) {
            if ($node === $needle) {
                return true;
            }
        }

        return 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);
	}
1003507
public static function contains(string $haystack, string $needle, int $offset = 0): bool
    {
        return self::strpos($haystack, $needle, $offset) !== false;
    }
476653
function contains($haystack, $needles)
    {
        (is_array($needles)) ?: $needles = array($needles);

        $r = false;
        foreach ($needles as $needle) {
            if ('' === $needle = (string) $needle)
                continue;

            $r |= (false !== mb_strpos($haystack, $needle));
        }

        return $r;
    }
1293537
public function endswith(string $haystack, string $needle) : bool
    {
        return (substr($haystack, -1 * strlen($needle)) === $needle);
    }
187255
protected function string_contains( $haystack, $needles ) {
		foreach ( (array) $needles as $needle ) {
			if ( '' !== $needle && mb_strpos( $haystack, $needle ) !== false ) {
				return true;
			}
		}

		return false;
	}
454947
public static function starts_with( $haystack, $needles ) {
		foreach ( (array) $needles as $needle ) {
			if ( '' !== $needle && 0 === strpos( $haystack, $needle ) ) {
				return true;
			}
		}

		return false;
	}