Is there a way to find a key=>value pair in a PHP array?

Jeremy

New member
I would like to know if it's possible to find a key=>value pair in a multidimensional array? For example, can you find fruit=>banana, or vegetable=>spinach in a multidimensional array called grocery list? If so, how would you do it? Thanks in advance! I'm stumped...
Thanks for the clarifying question. Here's my array:

Array
(
[0] => Array
(
[response_id] => 1
[question_id] => 1
[question_response] => a1
[customer_id] => customer1
)

[1] => Array
(
[response_id] => 2
[question_id] => 2
[question_response] => a2
[customer_id] => customer1
)

[2] => Array
(
[response_id] => 3
[question_id] => 3
[question_response] => a3
[customer_id] => customer1
)
)

Let's say that I wanted to find the array key that contained the key=>value pair 'question_id => 3'

Is there a way to find that in PHP? I know you can search by values and by keys, but I wasn't sure if you could search by key=>value pairs.

Best,
Jeremy
 
Back
Top