@param string $haystack
@param string $needle
@param bool   $ignoreCase

@return bool
336391
public static function endsWith($haystack, $needle, $ignoreCase = false)
    {
        if ($ignoreCase) {
            return strripos($haystack, $needle) === strlen($haystack) - strlen($needle);
        } else {
            return substr_compare($haystack, $needle, -strlen($needle)) === 0;
        }

    }
30804
public static function isNeedlesExists($haystack, $needles) {
        foreach($needles as $needle) {
            if(stripos($haystack, $needle)!==false){
                return true;
            }
        }
        return false;
    }
441400
public static function startsWith($haystack, $needle)
    {
        $length = strlen($needle);

        return substr($haystack, 0, $length) === $needle;
    }
111756
public static function startsWith($haystack, $needle)
    {
        return $needle === '' or mb_strrpos($haystack, $needle, -mb_strlen($haystack)) !== false;
    }
1191725
public static function within( $haystack, $needle, $offset = 0, $caseSensitive = false )
    {
        if ( false === $caseSensitive )
        {
            //	Case-insensitive
            return false !== stripos( $haystack, $needle, $offset );
        }

        //	Case-sensitive
        return false !== strpos( $haystack, $needle, $offset );
    }
1051470
public static function indexOf(string $haystack, string $needle, int $nth = 1): ?int
    {
        $pos = static::pos($haystack, $needle, $nth);

        return $pos === null
            ? null
            : \mb_strlen(\substr($haystack, 0, $pos));
    }
649501
public static function startsWith($haystack, $needle)
    {
        if (strlen($haystack) < strlen($needle)) {
            return false;
        }
        $start = substr($haystack, 0, strlen($needle));

        return $needle === "" || $needle === $start;
    }
105518
public static function filterCaseInsensitively(array $needles, array $haystack)
    {
        $result = array();
        $modifiedHaystack = array_change_key_case($haystack, CASE_LOWER);
        foreach ($needles as $needle) {
            $modifiedNeedle = strtolower($needle);
            if (array_key_exists($needle, $haystack)) {
                $result[$needle] = $haystack[$needle];
            } elseif (array_key_exists($modifiedNeedle, $modifiedHaystack)) {
                $result[$needle] = $modifiedHaystack[$modifiedNeedle];
            }
        }
        return $result;
    }
229443
public static function StartsWith($haystack, $needle)
    {
        $length = static::Length($needle);

        return substr($haystack, 0, $length) === $needle;
    }
978810
public static function textMatch($haystack, $needle, $collation, $matchType = 'contains')
    {
        switch ($collation) {
            case 'i;ascii-casemap':
                // default strtolower takes locale into consideration
                // we don't want this.
                $haystack = str_replace(range('a', 'z'), range('A', 'Z'), $haystack);
                $needle = str_replace(range('a', 'z'), range('A', 'Z'), $needle);
                break;

            case 'i;octet':
                // Do nothing
                break;

            case 'i;unicode-casemap':
                $haystack = mb_strtoupper($haystack, 'UTF-8');
                $needle = mb_strtoupper($needle, 'UTF-8');
                break;

            default:
                throw new Exception\BadRequest('Collation type: '.$collation.' is not supported');
        }

        switch ($matchType) {
            case 'contains':
                return false !== strpos($haystack, $needle);
            case 'equals':
                return $haystack === $needle;
            case 'starts-with':
                return 0 === strpos($haystack, $needle);
            case 'ends-with':
                return strrpos($haystack, $needle) === strlen($haystack) - strlen($needle);
            default:
                throw new Exception\BadRequest('Match-type: '.$matchType.' is not supported');
        }
    }
418456
public static function startsWith(string $haystack, string $needle, bool $caseSensitive = true)
    {
        if ($caseSensitive) {
            return $needle === '' || strpos($haystack, $needle) === 0;
        }

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

        return (bool)preg_match('|.*' . $needle . '.*|', $haystack);
    }
1211909
public static function endsWith($haystack, $needle, $case_sensitive = true)
    {
        $status = false;

        $compare_func = $case_sensitive ? 'mb_strrpos' : 'mb_strripos';

        foreach ((array)$needle as $each_needle) {
            $expectedPosition = mb_strlen($haystack) - mb_strlen($each_needle);
            $status = $each_needle === '' || $compare_func($haystack, $each_needle, 0) === $expectedPosition;
            if ($status) {
                break;
            }
        }

        return $status;
    }
31724
public static function hasBeginning(string $needle, string $haystack): bool
    {
        return $needle === '' || strpos($haystack, $needle) === 0;
    }
658158
public function hasKey(string $needle, array $haystack) : bool
    {
        foreach ($haystack as $key => $value) {
            if ($key === $needle) {
                return true;
            }

            if (is_array($value)) {
                if ($x = $this->hasKey($needle, $value)) {
                    return $x;
                }
            }
        }

        return false;
    }
828865
public function containsFilter($haystack, $needle)
    {
        if (empty($needle)) {
            return $haystack;
        }

        return (strpos($haystack, (string) $needle) !== false);
    }
266365
public static function endWith(string $haystack, string $needle): bool
    {
        return ($needle === mb_substr($haystack, -mb_strlen($needle, 'UTF-8'), null, 'UTF-8'));
    }