strrpos

@param string $haystack
@param string $needle
@param int    $offset

@return int|false
166171
public static function strrpos($haystack, $needle, $offset = null)
    {
        // Emulate strrpos behaviour (no warning)
        if (empty($haystack)) {
            return false;
        }

        return mb_strrpos($haystack, $needle, (int) $offset, static::ENC_UTF8);
    }
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));
    }
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;
    }
137790
public static function strStr($haystack, $needle, $beforeNeedle = false)
    {
        if (self::isMBString()) {
            return mb_strstr($haystack, $needle, $beforeNeedle, self::$encoding);
        }

        return strstr($haystack, $needle, $beforeNeedle); // @codeCoverageIgnore
    }
568066
public static function iPos($haystack, $needle, $offset = 0)
    {
        if (self::isMBString()) {
            return mb_stripos($haystack, $needle, $offset, self::$encoding);
        }

        return stripos($haystack, $needle, $offset); // @codeCoverageIgnore
    }
975820
public static function arraySearchGetValue($needle, array $haystack)
    {
        $lcNeedle = strtolower($needle);

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

        return null;
    }
690571
public static function inString($needle, $haystack, $insensitive = false)
    {
        if ($insensitive) {
            return false !== stristr($haystack, $needle);
        }

        return false !== strpos($haystack, $needle);
    }
310917
public static function substrInArray($needle, array $haystack)
    {
        $filtered = array_filter(
            $haystack,
            function($item) use ($needle) {
                return false !== strpos($item, $needle);
            }
        );

        /** @noinspection IsEmptyFunctionUsageInspection */
        return !empty($filtered);
    }
829816
public static function endsWith($haystack, $needle)
    {
        $hl = strlen($haystack);
        $nl = strlen($needle);
        if(substr($haystack, $hl-$nl, $hl) == $needle)
            return true;

        return false;
    }
394347
public static function subCount($haystack, $needle)
    {
        if (self::isMBString()) {
            return mb_substr_count($haystack, $needle, self::$encoding);
        }

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

        return (bool)preg_match('|.*' . $needle . '.*|', $haystack);
    }
229443
public static function StartsWith($haystack, $needle)
    {
        $length = static::Length($needle);

        return substr($haystack, 0, $length) === $needle;
    }
1010896
public static function  endsWith( $haystack , $needle )
	{
		return $needle === "" || ( ( $temp = strlen( $haystack ) - strlen( $needle ) ) >= 0 && strpos( $haystack , $needle , $temp ) !== false );
	}
404310
public static function substr_count(string $haystack, string $needle) {
		if (\function_exists('mb_substr_count')) {
			return \mb_substr_count($haystack, $needle, 'UTF-8');
		}
		else {
			return \substr_count($haystack, $needle);
		}
	}
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;
    }
620040
public static function stringEndsWith($haystack, $needle)
    {
        if (!is_string($haystack) || !is_string($needle)) {
            throw new \InvalidArgumentException('Not a string');
        }

        return (strrpos($haystack, $needle) + strlen($needle)) === strlen($haystack);
    }