|
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
[Back to original message]
|