Re: Multi-array - What am I missing?
| From: | Micah Gersten | Date: | Wed, 23 Jul 2008 20:06:13 +0000 |
| Subject: | Re: Multi-array - What am I missing? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277205@lists.php.net to get a copy of this message | ||
Nice catch, I missed that.
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
Jason Norwood-Young wrote:
> On Wed, 2008-07-23 at 13:52 -0500, Chris Ditty wrote:
>
>> Can anyone point me in the right direction? I know I am missing something
>> simple, but I can't place my hands on it.
>>
>> $myCalTime = act_getCalendarDays($config, $myMonth, $myYear);
>>
>> foreach($myCalTime as $calTime => $calArrayTime){
>> $calArray[] =
>> $calArrayTime['day']."=>array('NULL','linked-day
>>
>> ".strtolower($calArrayTime['reason'])."','".$calArrayTime['day']."'),";
>> }
>>
>> act_getCalendarDays returns this....
>> Array
>> (
>> [day] => Array
>> (
>> [0] => 05
>> [1] => 06
>> [2] => 26
>> [3] => 27
>> )
>>
>> [reason] => Array
>> (
>> [0] => Vacation
>> [1] => Vacation
>> [2] => Vacation
>> [3] => Vacation
>> )
>>
>> )
>>
>>
>> What am I missing to get this
>> =>array('NULL=','linked-day ',''),
>>
>> to look like this
>> 05=>array(NULL,'linked-day vacation','05'),
>>
>
> Your myCalTime isn't an array of arrays of arrays, like you're
> suggesting in the foreach.
>
> $calArray=array();
> for($x=0;$x<sizeof($myCalTime["day"]);$x++) {
>
> $calArray[]=$myCalTime["day"][$x]."=>array('NULL','linked-day
>
> ".strtolower($myCalTime['reason'][$x])."','".$myCalTime['day'][$x]."'),";
> }
>
>
>