php: how to get associative array key from numeric index?
You don’t. Your array doesn’t have a key [1]. You could: Make a new array, which contains the keys: $newArray = array_keys($array); echo $newArray[0]; But the value “one” is at $newArray[0], not [1]. A shortcut would be: echo current(array_keys($array)); Get the first key of the array: reset($array); echo key($array); Get the key corresponding to the … Read more