How to get the index of item from an array in PHP

1 Answer

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

$index =  array_search("C", $arr);

echo "index = " . $index;

/*
run:
  
index = 1 
  
*/

 



answered Apr 8, 2016 by avibootz

Related questions

1 answer 249 views
1 answer 281 views
1 answer 225 views
1 answer 269 views
1 answer 287 views
...