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;
        }
    }