Retrieve array key passed on value PHP

Posted by Doodle on Stack Overflow See other posts from Stack Overflow or by Doodle
Published on 2010-06-05T20:29:55Z Indexed on 2010/06/05 20:32 UTC
Read the original article Hit count: 160

Filed under:
|
|

I have the following array

$group= array(
[0] => 'apple',
[1] => 'orange',
[2] => 'gorilla'
);

I run the array group through an for each function and when the loop hits values of gorilla I want it to spit out the index of gorilla

foreach( $group as $key){

if ($key==gorilla){
echo   //<------ the index of gorilla
}

}

© Stack Overflow or respective owner

Related posts about php

Related posts about array