Get the index value of an array in php

Posted by Aakash Chakravarthy on Stack Overflow See other posts from Stack Overflow or by Aakash Chakravarthy
Published on 2010-06-02T15:38:27Z Indexed on 2010/06/02 15:44 UTC
Read the original article Hit count: 273

Filed under:

Hello,

I have array

$list = array('string1', 'string2', 'string3');

Now i want to get the index of the value string2 i.e 1 and 2 for string3

All i want is the position of the strings in the array

string1 in 0
string2 in 1
string3 in 2

positions

How to get this ? i used array_search but it is no use ! please help !

© Stack Overflow or respective owner

Related posts about php