Re: note 24542 added to ref.strings
| From: | Jesus M. Castagnetto | Date: | Wed, 21 Aug 2002 21:42:22 +0000 |
| Subject: | Re: note 24542 added to ref.strings | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-35323@lists.php.net to get a copy of this message | ||
Once was enough I removed one of your notes.
Tnxs for the contribution, but be careful next time.
--- global2b@yahoo.com wrote:
> In case any of you wanted to parse a deliminated
> text file, I've come up with a script that may of
> some use.
>
> //I call the function and return the parsed data in
> a multi-D array.
>
> function thisone() {
> $info = array();
> $x=file("yourData.txt");
>
> //Here I take the first line of the data file and
> grab the variable names.
> $names = explode('|',$x[0]);
>
> //Once I've got the variable names I delete x[0] so
> that I can run through the info array with foreach
> unset($x[0]);
>
> foreach($x as $keyx=>$valuex) {
> $w = explode('|',$valuex);
>
> foreach($w as $keyw=>$valuew) {
> $info[$keyx][$names[$keyw]] = $valuew;
> }
> }
>
> return $info;
> }
>
> $bin = thisone();
> print_r($bin);
> --
> http://www.php.net/manual/en/ref.strings.php
>
http://master.php.net/manage/user-notes.php?action=edit+24542
>
http://master.php.net/manage/user-notes.php?action=delete+24542
>
http://master.php.net/manage/user-notes.php?action=reject+24542
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
=====
--- Jesus M. Castagnetto <jmcastagnetto@php.net>
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com