PHP key() FunctionLast Updated : 17 Mar 2025 The key( ) function returns the element key from the current internal pointer position. This function was introduced in 4.0. SyntaxParameter
ReturnsThe key( ) returns the key of the array element that is currently being pointed by the internal pointer. Example 1Output: The key from the current position is: 0 Example 2Output: Current position Key is : Subject1 Example 3Output: Current position Key is :tata Example 4Output: The key from the current position is: 0 Next TopicPhp-array-key-last-function |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India