|
Posted by Erwin Moller on May 14, 2008, 9:08 am
Please log in for more thread options Erwin Moller schreef:
> Bob Bedford schreef:
>> Hi Erwin,
>>
>> thanks for replying.
>>
>> Reading is not a problem. I've a problem to "build" the associative
>> array.
>>
>> "Erwin Moller"
>> écrit dans le message de news:
>> 482adfa6$0$14347$e4fe514c@news.xs4all.nl...
>>> Bob Bedford schreef:
>>>> Hi all,
>>>>
>>>> it's there any simple way to create an array of years and months
>>>> dynamically (2 loops) for an associative array ?
>>>> I've tried this so far: (having an error on last line with the "=>"
>>>> sign.
>>>>
>>>> $table = array();
>>>> for($i=2005;$i<=date('y');$i++){
>>>> $table = array_push($i=>array());
>>>> for($d=1;$d<=12;$d++)
>>>> $table[$i] = array_push($table,$i=>0);
>>>> }
>>>>
>>>> What I need is to create a table wich will then be written and
>>>> readed using $table[$year][$month] = $somevalue;
>>>>
>>>> Thanks for helping.
>>> Hi,
>>>
>>> $table = array();
>>> for($i=2005;$i<=date('y');$i++){
>>> for($d=1;$d<=12;$d++)
>>> $table[$i][$d] = "somevalue";
>>> }
>>>
>>> Something like that?
>>>
>>> Regards,
>>> Erwin Moller
>>>
>>
>
> Hi,
>
> [Please don't toppost]
>
> Can you give us an example of that targetarray?
> eg:
> [2005][1] = ...
> [2005][2] = ...
> ???
>
> It is not clear to me.
> What is it you want as a result?
[correction]
> And where does the associative array come in?
>
I ment: Where does the associative array come into the picture?
Another thing: You said my samplecode 'reads' the array.
It does not, it creates it.
Regards,
Erwin Moller
|