PHP SplObjectStorage offsetExists() Function Last Updated : 23 Jun, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The SplObjectStorage::offsetExists() function is an inbuilt function in PHP which is used to check the object exist in storage or not. Syntax: bool SplObjectStorage::offsetExists($object) Parameters: This function accepts a single parameter $object which specifies the object to be checked.Return Value: This function returns true if the object exists in storage otherwise return false.Below programs illustrate the SplObjectStorage::offsetExists() function in PHP: Program 1: php <?php // Create an empty SplObjectStorage $str = new SplObjectStorage; $obj = new StdClass; // Attach $obj to $str $str->attach($obj); // Print Result var_dump($str->offsetExists($obj)); ?> Output: bool(true) Program 2: php <?php // Create an Empty SplObjectStorage $str = new SplObjectStorage(); $obj1 = new StdClass; $obj2 = new StdClass; $obj3 = new StdClass; $obj4 = new StdClass; // Attach only three objects $str->attach($obj1, "GeksforGeeks"); $str->attach($obj2, "GFG"); $str->attach($obj3); // Print result var_dump($str->offsetExists($obj1)); var_dump($str->offsetExists($obj2)); var_dump($str->offsetExists($obj4)); var_dump($str->offsetExists($obj3)); ?> Output: bool(true) bool(true) bool(false) bool(true) Reference: https://www.php.net/manual/en/splobjectstorage.offsetexists.php Comment More infoAdvertise with us Next Article PHP SplObjectStorage offsetExists() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP SplObjectStorage offsetSet() Function The SplObjectStorage::offsetSet() function is an inbuilt function in PHP which is used to set the object of storage. Syntax: void SplObjectStorage::offsetSet($obj, $val) Parameters: This function accept two parameters as mention above and described below: $obj: It specifies the object to be attach.$ 1 min read PHP SplObjectStorage offsetGet() Function The SplObjectStorage::offsetGet() function is an inbuilt function in PHP that is used to get the data associated with the object. Syntax: object SplObjectStorage::offsetGet($obj) Parameters: This function accepts a single parameter $obj which specifies the object to be fetched. Return Value: This fu 1 min read PHP SplObjectStorage offsetUnset() Function The SplObjectStorage::offsetUnset() function is an inbuilt function in PHP that is used to set the object from the storage. Syntax: void SplObjectStorage::offsetUnset( $object ) Parameters: This function accepts a single parameter $object which specifies the to be unset. Return Value: This function 1 min read PHP SplObjectStorage next() Function The SplObjectStorage::next() function is an inbuilt function in PHP which is used to move to next entry of storage. Syntax: void SplObjectStorage::next() Parameters: This function does not accept any parameter. Return Value: This function does not return any value. Below programs illustrate the SplO 1 min read PHP SplObjectStorage getinfo() Function The SplObjectStorage::getinfo() function is an inbuilt function in PHP that is used to get the data associated with the object by the current iterator position. Syntax: mixed SplObjectStorage::getinfo() Parameters: This function does not accept any parameter. Return Value: This function returns the 1 min read Like