How to search for value and get the key with fro array with current() and next() functions in PHP

1 Answer

0 votes
$arr = array("C", "PHP", "C#", "C++", "JAVA");

while ($s = current($arr)) 
{
    if ($s == 'C#') 
         echo key($arr);
    
    next($arr);
}


/*
run:

2 
   
*/

 



answered Mar 8, 2016 by avibootz
...