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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: karsten at typo3 dot org
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Apr 25 21:01:36 2024 UTC