public static function replaceLast($search, $replace, $subject)
    {
        $search = (string) $search;

        if ($search === '') {