src/Common/Helper/Strings.php
public static function replaceLastOccurrence($sString, $sReplace, $sSubject)
    {
        $iPos = strrpos($sSubject, $sString);

        if ($iPos !== false) {
            $sSubject = substr_replace($sSubject, $sReplace, $iPos, strlen($sString));
        }

        return $sSubject;
    }
public static function replaceLastOccurrence($sString, $sReplace, $sSubject)
    {
        $iPos = strrpos($sSubject, $sString);

        if ($iPos !== false) {
            $sSubject = substr_replace($sSubject, $sReplace, $iPos, strlen($sString));
        }

        return $sSubject;
    }
public static function replaceLastOccurrence ( $ sString , $ sReplace , $ sSubject ) { $ iPos = strrpos ( $ sSubject , $ sString ) ; if ( $ iPos !== false ) { $ sSubject = substr_replace ( $ sSubject , $ sReplace , $ iPos , strlen ( $ sString ) ) ; } return $ sSubject ; }
Replace the last occurrence of a string within a string with a string

@param string $sString  The substring to replace
@param string $sReplace The string to replace the substring with
@param string $sSubject The string to search

@return string
Replace the last occurrence of a string within a string with a string