The offsetExists() function of the ArrayObject class in PHP is used to whether a given offset or index is present in the ArrayObject or not. If it is present then the function returns a boolean True value otherwise it returns False.
Parameters: This function accepts a single parameter $index which is the index which is to be checked if it is present in the ArrayObject.
Return Value: This function returns a boolean value True or False based on whether the index is present in the ArrayObject or not.
Below programs illustrate the above function:
ArrayObject Object ( [storage:ArrayObject:private] => Array (  => geeks100  => geeks99  => geeks1  => geeks02 ) ) The key 1 is present! The key 20 is not present!
ArrayObject Object ( [storage:ArrayObject:private] => Array ( [Welcome] => 1 [to] => 2 [GfG] => 3 ) ) The key Welcome is present! The key GfG is present!
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.