You are here: Re: search in an array of array « PHP Programming Language « IT news, forums, messages
Re: search in an array of array

Posted by Rik Wasmus on 11/05/07 16:38

On Mon, 05 Nov 2007 17:14:20 +0100, Steve <no.one@example.com> wrote:

>> $list =3D array();
>> array_push($list,array(1,1,'x','x');
>> array_push($list,array(1,2,'x','y');
>> array_push($list,array(2,1,'y','x');
>> array_push($list,array(2,2,'y','y');
>>
>> $result =3D array();
>> $result =3D findvalue(1,2); //should return 'x','y'
>>
>> function findvalue($a,$b){
>> //return the array of values...
>> }
>
> print_r($list[1][2]);

Yet he wants to find the record in $list[1].

OP: for a single search a foreach loop or customized array_filter come t=
o =

mind. If you have to search a lot of entries, you might want to build an=
=

array of references, indezing the array. Be very, very sure you need it =
=

though, your code becomes somewhat unreadable by another coder.
-- =

Rik Wasmus

 

Navigation:

[Reply to this 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

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