How can I get the numeric Index of an array when the index is a string?
i.e
$myArray = array (first = my first value,
second = my second value,
third = my third value);
Lets say I want the Index of the my second one: this would be second
or numerid 1
Natascha Chrobok wrote:
How can I get the numeric Index of an array when the index is a string?
string indexes don't have numeric indexes. they are in order however, if
you want to find the order of a value, use:
echo array_search(array_search(my second value, $myArray),
array_keys($myArray));
2 matches
Mail list logo