The SplObjectStorage::key() function is an inbuilt function in PHP which is used to get the index of the currently pointing iterator.
Parameters: This function does not accept any parameter.
Return Value: This function returns the index at which the iterator currently pointing.
Below programs illustrate the SplObjectStorage::key() function in PHP:
int(0) string(12) "GeksforGeeks" int(1) string(3) "GFG" int(2) NULL int(3) string(3) "DSA"
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.