src/Viserio/Component/Support/Str.php
public static function replaceLast(string $search, string $replace, string $subject): string
    {
        $position = \mb_strrpos($subject, $search);

        return self::replaceByPosition($subject, $replace, $position, $search);
    }
public static function replaceLast(string $search, string $replace, string $subject): string
    {
        $position = \mb_strrpos($subject, $search);

        return self::replaceByPosition($subject, $replace, $position, $search);
    }
Replace the last occurrence of a given value in the string.

@param string $search
@param string $replace
@param string $subject

@return string