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