src/Lib/StringTool.php
public static function last_replace($search, $replace, $string)
    {
        $pos = strrpos($string, $search);
        
        if($pos !== false)
        {
            return substr_replace($string, $replace, $pos, strlen($search));
        }
        else
        {
            return $string;
        }
    }
public static function last_replace($search, $replace, $string)
    {
        $pos = strrpos($string, $search);
        
        if($pos !== false)
        {
            return substr_replace($string, $replace, $pos, strlen($search));
        }
        else
        {
            return $string;
        }
    }
public static function last_replace ( $ search , $ replace , $ string ) { $ pos = strrpos ( $ string , $ search ) ; if ( $ pos !== false ) { return substr_replace ( $ string , $ replace , $ pos , strlen ( $ search ) ) ; } else { return $ string ; } }
Replace the last occurence of a substring in a string

@param string $search
@param string $replace
@param string $string
Replace the last occurence of a substring in a string