php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47046 Ass equivalent of array_merge() for SplObjectStorage
Submitted: 2009-01-09 10:29 UTC Modified: 2009-01-16 22:33 UTC
From: karsten at typo3 dot org Assigned: colder (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 5.3.0alpha3 OS: Mac OS X 10.5.6
Private report: No CVE-ID: None
 [2009-01-09 10:29 UTC] karsten at typo3 dot org
Description:
------------
SplObjectStorage is a great replacement for arrays when it comes to 
storing objects. But with arrays one could use array_merge to combine 
sets, for SplObjectStorage there is no such simple way. Resorting to a 
foreach/attach loop seems cumbersome and is probably slower than an 
internal solution would be.

I could imagine to have a merge() method on SplObjectStorage. It should 
directly modify the called object by merging the given argument.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-16 22:33 UTC] colder@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

$os = new SplObjectStorage;
$other = new SplObjectStorage;
// ...
$os->addAll($other);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC