You are here: Re: [PHP] Split command problem « PHP « IT news, forums, messages
Re: [PHP] Split command problem

Posted by Jason Wong on 04/11/05 09:37

On Monday 11 April 2005 09:27, Russ wrote:
> I have been trying to get the following code working. I keep getting an
> error on line nine.

And the error is?

> It looks simular to the example in the PHP online
> manual. If I substitute a print command for line nine I get the correct
> information from $_POST[username]. I must be missing or have an extra a
> quote but I cannot figure out where.

> name($fname, $lname) = split('[/\s+/]', "$_POST[username]");

split() probably uses POSIX regex and hence knows nothing about '\s'. Use
preg_split() instead:

list($fname, $lname) = preg_split('/\s+/', $_POST['username']);

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

 

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

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