You are here: Re: RegExp : using end-of-line in a pattern « PHP Programming Language « IT news, forums, messages
Re: RegExp : using end-of-line in a pattern

Posted by Zilla on 09/21/05 14:58

Damien wrote:
> Hi to all,
> I would like to get field values from a multi-line text.
>
> For instance :
> "
> Name: Mr Smith
> Address: Paris
> "
>

Im not sure what you want, but if you want to get the different lines in
different variables, then you can use the explode()-function to split
the string:

$lines = explode("\n", $string);

The above code would give an array $lines where each array-element
contains one line of $string.

If $string contains

"Name: Mr Smith
Address: Paris"

then $lines[0] contains "Name: Mr Smith" and $lines[1] contains
"Address: Paris".

More information on the explode()-function: www.php.net/explode

Zilla

 

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

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