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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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 17:01:58 2024 UTC