By any means can I find an array for one value and return it's key, I tried array_search ()
with no success ... Below is an example of my array
[0] = & gt; Array ([value] = & gt; [text] = & gt; all call types) [1] = & gt; Array ([value] = & gt; test [text] => renewal inquiry) [2] = & gt; Array ([value] = & gt; msg [text] => message to pass) ...
Converting my last goal
value to text
.
Here's what I've tried:
$ key = array_search ($ row ['Call_type'], $ type_list); $ Call_type_name = $ type_list [list] [$ key] ['text'];
Thanks!
Are you after this? To know the position of a specific value situation?
function findKeyByField ($ arr, $ name, $ val) {$ pos = 0; Forex Currency ($ subArr as $ AR): foreach ($ subArr $ key = & gt; $ value): If ($ key == $ name and $ value == $ val) {return $ pos; } Endaurach; $ Position ++; Endforeach; }
Comments
Post a Comment