php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #43154 __toArray() or __toIterator() Magic Method?
Submitted: 2007-10-31 00:21 UTC Modified: 2007-11-06 13:18 UTC
From: smoseley at transio dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.4 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: smoseley at transio dot com
New email:
PHP Version: OS:

 

 [2007-10-31 00:21 UTC] smoseley at transio dot com
Description:
------------
Would love to see a __toArray() MM added that would default to an associative array of an object's properties in scope, but that could be overloaded with whatever.  It would be very useful in cases where a specific method is required to iterate through an object's properties.  Thanks! :)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-31 00:27 UTC] johannes@php.net
What's wrong with the Iterator and IteratorAggregate interfaces?
 [2007-11-06 13:18 UTC] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

There is also iterator_to_array().
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC