You are here: Re: Function to strip returns « PHP Programming Language « IT news, forums, messages
Re: Function to strip returns

Posted by JackM on 11/01/05 04:29

JackM wrote:

> I'm trying to write a function that will trim and strip new line
> character returns from submitted $_POST values. Does this look serviceable?
>
> function trim_data($formdata)
> {
> foreach ($formdata as $key => $value)
> {
> $value = preg_replace("(\r\n|\n|\r|\t)", "", $value);
> $newdata[trim($key)] = trim($value);
>
> }
> return $newdata;
> }

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?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация