Re: array in PHP

From: Piet (p.potjer_at_chello.nl)
Date: 12/03/04


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.)
>>
>
>



Relevant Pages

  • Applescript and Autoformat (search and replace), Word 2004
    ... script that will take care of a recurring editing issue with nested ... quotes to double quotes, ... set oldauto2 to auto format as you type replace quotes ... set auto format as you type replace quotes to false ...
    (microsoft.public.mac.office.word)
  • Re: Accessing full command line or parameters WITH QUOTES
    ... The problem is that VBScript doesn't allow access to the full command line ... rebuild the parameters with the quotes inserted properly. ... When I was writing the script on XP, I managed to cheat and grab the ...
    (microsoft.public.scripting.vbscript)
  • Re: Database/Email Script
    ... Both double and single quotes work for quoting array indexes. ... the relevant code. ... What I would like first would be to get the script working. ... task as a learning experience.) ...
    (comp.lang.php)
  • Re: basic help to run an application from WSH
    ... string values must be enclosed in quotes. ... The Run method will execute on c:\notepad.exe. ... I'm just learning vbscript for wsh and here is my first script, ... Also if I cut and paste the exact file path from the script into the ...
    (microsoft.public.scripting.vbscript)
  • Re: Interesting Discussion with my PHP Teacher
    ... ## For a small script like this one, ... > it wher the sql statement is constructed because there are too many quotes. ...
    (comp.lang.php)