RE: [PHP] trouble with each() list() and array()

From: Date: Tue, 21 Nov 2000 02:11:16 +0000
Subject: RE: [PHP] trouble with each() list() and array()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-26380@lists.php.net to get a copy of this message
and how do I create a list in memory? Like, if I have a text file with each line containing name|lastname|email in C I'd create a struct called X typedef struct X { char *name; char *lname; char *email; } and just loop around the file until EOF feeding a list of X, right? I didn't quite get how to do things like that in PHP. The same problem with binary files, how do I read them without structs?? Just make multi-dimensioned arrays, like this for example... $friends[1][name]="John"; $friends[1][email]="john@domain.com"; $friends[2][name]="Mary"; $friends[2][email]="mary@anotherdomain.com";
cool... so If I want to feed a list I can just do that: while(fgets($str,lenght,file)) { code ... break $str ... code... $friends[][name]=$name; $friends[][email]=$email; } right? and I should forget about structs and start using DBs? After all that's what DBs are for. cutting to the chase... there are no pointers in PHP, no structs. And this is due it's ease to deal with DBs, correct? ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer

« previous php.general (#26380) next »