Jump to content

[SOLVED] Array Get Key of a Value


The Little Guy

Recommended Posts

I want to grab the key for a given value.

 

$array = array(
    'fruit1' => 'apple',
    'fruit2' => 'orange',
    'fruit3' => 'grape',
    'fruit4' => 'apple');

 

If I want find the key fro orange, I need the value to return fruit2

 

how can I do that?

Link to comment
https://forums.phpfreaks.com/topic/132485-solved-array-get-key-of-a-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.