How to get first element of array in php using key and how to find first key of array?
Asked
Active
Viewed 113 times
0
-
Can you please provide code. – Ravneet Dec 17 '15 at 05:13
-
post what you tried? and what issues you faced – Syed mohamed aladeen Dec 17 '15 at 05:13
-
you can use key($array) – Chetan Ameta Dec 17 '15 at 05:13
1 Answers
2
You can try this -
$key = array_shift(array_keys($yourArray));
echo $yourArray[$key];

Sougata Bose
- 31,517
- 8
- 49
- 87