The first one is slower because regular expressions have a lot of overhead. If you're going to use that method, I'd use preg_replace() instead of ereg_replace(), again for speed. As they note on php.net, "preg_replace(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg_replace()."
Of course, if you're using PHP < 4.2.0, Perl-style regex (PCRE) isn't enabled by default, so I'd just go with Extended regex (ereg_replace()) in lieu of recompiling PHP.