Searching Arrays, array_search() issue

Posted by Mikey1980 on Stack Overflow See other posts from Stack Overflow or by Mikey1980
Published on 2010-05-17T15:35:46Z Indexed on 2010/05/17 15:40 UTC
Read the original article Hit count: 137

Filed under:

Is there any way I can search an array for a value and return it's key, I tried array_search() with no success... below is an example of my array

[0] => Array ( [value] => [text] => All Call Types )

[1] => Array
    (
        [value] => enquiry
        [text] => Renovation Enquiry
    )

[2] => Array
    (
        [value] => msg
        [text] => Message to Pass on
    ) ...

My ultimate goal is to convert

value to text.

Here's what I tried:

$key = array_search($row['call_type'], $type_list);
$call_type_name = $type_list[$key]['text'];

Thanks!

© Stack Overflow or respective owner

Related posts about php