Re: array in PHP
From: d (d_at_example.com)
Date: 12/03/04
- Next message: Moritz Behner: "Laufschrift mit xml Inhalt"
- Previous message: d: "Re: listing from a database"
- In reply to: Piet: "array in PHP"
- Next in thread: Piet: "Re: array in PHP"
- Reply: Piet: "Re: array in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 03 Dec 2004 12:59:27 GMT
For one thing, you should put your textual keys in quotes, so $List[1][Name]
becomes $List[1]["Name"]. PHP shouldn't support the method you use (as,
technically, Name should be a constant in your script, not a textual key) -
it just does to prevent people's code from breaking :)
Try changing that and see if it helps.
If not, put some values in your array then put this command at the very end
of your script:
var_dump($List);
It will display the contents of the $List variable, letting you see if
things are as they should be.
d
"Piet" <p.potjer@chello.nl> wrote in message
news:jjZrd.56081$lN.17932@amsnews05.chello.com...
> Hi,
>
> I try to use a two-dimension array in a function.
> It is declared as global (global $List).
> When it is filled the first time everything seems to be okay:
> $List[1][Name]="Pete";
> When I call the function again I fill it like
> $List[2][Name]="Chris";
> The result seems good, but the foolish effect is that $List[1][Name] is
> empty then.
> What is going wrong? Can anybody help me?
> (I use PHP 4.3.8.)
>
- Next message: Moritz Behner: "Laufschrift mit xml Inhalt"
- Previous message: d: "Re: listing from a database"
- In reply to: Piet: "array in PHP"
- Next in thread: Piet: "Re: array in PHP"
- Reply: Piet: "Re: array in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]