Reply to Re: multidimensional array of arrays

Your name:

Reply:


Posted by RageARC on 09/27/07 20:13

On 27 Sep, 20:58, JackpipE <pipe.j...@gmail.com> wrote:
> I need to create multidimensional array with arrays inside of it.
>
> database
>
> name | value1 | value2
> john | red | 45
> john | red | 56
> john | yellow | 11
> mike | blue | 23
> mike | black | 41
>
> I would like to get this in this array format:
> Array ([john] => Array( [0]=>red [1]=>red [2]=>yellow) Array( [0]=>45
> [1]=>56 [2]=>11))
>
> The idea as you can see is to have value1 and value2 as separate array
> within the name array.
>
> Thanks,
> Jack

$array = array(
'john' => array('VALUE1' => 'red', 'VALUE2' => '45'),
[...]
);

usage example:

print $array['JOHN']['VALUE1']; // Outputs red.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация