crazymao Posted August 14, 2011 Share Posted August 14, 2011 I would like to get the key from an array at a specific point, I know that there is a key() function but the syntax does not apply to my situation, it works like key($array) but what I want is more like key($array[2]) Thanks alot Quote Link to comment https://forums.phpfreaks.com/topic/244778-get-key-from-array-at-specific-point/ Share on other sites More sharing options...
jcbones Posted August 14, 2011 Share Posted August 14, 2011 $keys = array_keys($arr); echo $keys[2]; http://php.net/manual/en/function.array-keys.php Quote Link to comment https://forums.phpfreaks.com/topic/244778-get-key-from-array-at-specific-point/#findComment-1257292 Share on other sites More sharing options...
crazymao Posted August 14, 2011 Author Share Posted August 14, 2011 thanks alot! Quote Link to comment https://forums.phpfreaks.com/topic/244778-get-key-from-array-at-specific-point/#findComment-1257298 Share on other sites More sharing options...
jcbones Posted August 14, 2011 Share Posted August 14, 2011 Your Welcome! Quote Link to comment https://forums.phpfreaks.com/topic/244778-get-key-from-array-at-specific-point/#findComment-1257301 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.