Re: array in PHP
From: Piet (p.potjer_at_chello.nl)
Date: 12/03/04
- Next message: Oli Filth: "Re: why don't we all use comp.lang.php ?"
- Previous message: Floortje: "Re: listing from a database"
- In reply to: d: "Re: array in PHP"
- Next in thread: d: "Re: array in PHP"
- Reply: d: "Re: array in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 03 Dec 2004 13:40:24 GMT
You're right: in my message I did not mention the quotes. I did in my
script. Sorry.
So the problem remains: The content of List[1]["Name"} disappears when I
call the function again.
"d" <d@example.com> schreef in bericht
news:PqZrd.79502$38.8284@fe2.news.blueyonder.co.uk...
> 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: Oli Filth: "Re: why don't we all use comp.lang.php ?"
- Previous message: Floortje: "Re: listing from a database"
- In reply to: d: "Re: array in PHP"
- Next in thread: d: "Re: array in PHP"
- Reply: d: "Re: array in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|