Re: Creating an Array from a Multi-line string (Help appreciated)
| From: | Ernest E Vogelsinger | Date: | Wed, 12 Mar 2003 20:23:40 +0000 |
| Subject: | Re: Creating an Array from a Multi-line string (Help appreciated) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139381@lists.php.net to get a copy of this message | ||
At 21:10 12.03.2003, Bix said:
--------------------[snip]--------------------
>I am creating an interface page with a multi line text box which will
>recieve a list of phone numbers on individual lines, so:
>
>12345
>12345
>12345
>and so on...
>
>I need to carry out an operation on each of these numbers (add them to a
>mysql db, but thats not important).
>
>Is it possible to recieve this text box in my php script and reference each
>line? Ideally put it into an array and reference by $number['0']
>$number['1'] and so on, so i can have a 'for' loop going?
--------------------[snip]--------------------
If you are certain that the lines are separated by a CR you could simply use
$phonearray = explode("\n", $_REQUEST['phones']);
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/