You are here: Re: designer and noob with an "empty expression" question « All PHP « IT news, forums, messages
Re: designer and noob with an "empty expression" question

Posted by ZeldorBlat on 04/30/07 13:44

On Apr 29, 10:42 pm, "uncleclinto" <walterswebdes...@comcast.net>
wrote:
> Hey all,
>
> I'm a designer, not a developer, but I'm trying to learn. Anyway, I'm
> trying to get a contact form working, but apparently I have some empty
> expressions here. Of course, I don't know what the heck to put in them.
> Here's the lines in question. Any ideas other than "stick with design" and
> some choice explitives?
>
> $_POST['email'] = preg_replace("\r", "", $_POST['email']);
> $_POST['email'] = preg_replace("\n", "", $_POST['email']);
>
> Uncleclinto

Why does everyone use a regular expression for simple find/replace
operations like this? Much easier, and probably a bit faster:

str_replace(array("\n", "\r"), '', $_POST['email']);

 

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

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