|
Posted by Ewoud Dronkert on 11/01/05 13:17
JackM wrote:
> ZeldorBlat wrote:
>
> >> $value = str_replace(array("\r", "\n", "\t"), '', $value);
>
> Ewoud Dronkert wrote:
>
> > $value = preg_replace('/[\r\n\t]+/', '', $value);
>
>
> Interesting. So what would the preferred method be or is that just
> splitting hairs?
In principle, I say prefer str_replace. Maybe if $value contained lots of
consecutive \r, \n or \t, the regexp might even be a little faster?
Actually I didn't think about the possibility to use an array argument for
str_replace so just used a regexp, with which I'm quite comfortable.
--
E. Dronkert
Navigation:
[Reply to this message]
|