PHP SplObjectStorage addAll() Function Last Updated : 23 Jun, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The SplObjectStorage::addAll() function is an inbuilt function in PHP which is used to add elements from another storage. Syntax: void SplObjectStorage::addAll( $value ) Parameters: This function accepts a single parameter $value which holds an storage which need to import. Return Value: It does not return any value. Below programs illustrate the SplObjectStorage::addAll() function in PHP: Program 1: php <?php // Declare an empty std class $obj = new StdClass; // Declare an empty SplObjectStorage $gfg = new SplObjectStorage(); $gfg[$obj] = "GeeksforGeeks"; $gfg1 = new SplObjectStorage(); $gfg1->addAll($gfg); // Print result added to storage object echo $gfg1[$obj] . "\n"; ?> Output: GeeksforGeeks Program 2: php <?php // Declare an empty std class $obj = new StdClass; $obj2 = new StdClass; // Declare an empty SplObjectStorage $gfg = new SplObjectStorage(); $gfg[$obj] = "GeeksforGeeks"; $gfg[$obj2] = "GeeksforGeeks2"; $gfg1 = new SplObjectStorage(); $gfg1->addAll($gfg); // Print result with whole object print_r($gfg1); ?> Output: SplObjectStorage Object ( [storage:SplObjectStorage:private] => Array ( [00000000219a7b260000000055def3bf] => Array ( [obj] => stdClass Object ( ) [inf] => GeeksforGeeks ) [00000000219a7b250000000055def3bf] => Array ( [obj] => stdClass Object ( ) [inf] => GeeksforGeeks2 ) ) ) Reference: https://www.php.net/manual/en/splobjectstorage.addall.php Comment More infoAdvertise with us Next Article PHP SplObjectStorage contains() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP SplObjectStorage attach() Function The SplObjectStorage::attach() function is an inbuilt function in PHP which is used to add objects into the SplObjectStorage. Syntax: void SplObjectStorage::attach($obj, $val) Parameters: This function accepts two parameters as mention above and described below. $obj: This is required parameter whic 1 min read PHP SplObjectStorage detach() Function The SplObjectStorage::detach() function is an inbuilt function in PHP which is used to remove objects from the storage. Syntax: void SplObjectStorage::detach($obj) Parameters: This function accepts a single parameter $obj which specifies the object to be remove from the storage. Return Value: This f 1 min read PHP SplObjectStorage count() Function The SplObjectStorage::count() function is an inbuilt function in PHP which is used to count the number of objects in storage. Syntax: int SplObjectStorage::count() Parameters: This function does not contains any parameter. Return Value: This function returns number of objects in storage. Below progr 1 min read PHP SplObjectStorage contains() Function The SplObjectStorage::contains() function is an inbuilt function in PHP which is used to check the storage object contains a specified object or not. Syntax: bool SplObjectStorage::contains( $value ) Parameters: This function accepts a single parameter $value which specifies the storage object which 1 min read PHP SplObjectStorage key() Function The SplObjectStorage::key() function is an inbuilt function in PHP which is used to get the index of the currently pointing iterator. Syntax: int SplObjectStorage::key() Parameters: This function does not accept any parameter. Return Value: This function returns the index at which the iterator curre 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 Like