Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #13752
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: ArrayAccess interface, Traversable interface and foreach |
| Date | 2014-05-24 07:09 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <llpulj$uc5$1@dont-email.me> (permalink) |
| References | <fdd1f0af-6cbf-4577-a4c4-7c9073eae483@googlegroups.com> <53806ec6$0$6713$9b4e6d93@newsspool2.arcor-online.net> |
On 5/24/2014 6:05 AM, Christoph Michael Becker wrote: > kurtk@pobox.com wrote: > >> The documentation for ArrayAccess (at >> http://www.php.net/manual/en/class.arrayaccess.php) doesn't show it >> implementing Traversable. Nevertheless, you can still use any class >> you write that implements ArrayAccess in a foreach loop. >> >> This seems like an oversight in the documentation--unless I am >> missing something? > > You can use any object (whether it is an instance of a class that > implements Traversable or not) in a foreach loop, see > <http://www.php.net/manual/en/control-structures.foreach.php>. > But that is an entirely different access to what Kurt is talking about. Kurt is discussing how to transverse an array within an object; your page discusses how to transverse public data members in an object. But good OO practices says all data members should be private. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
ArrayAccess interface, Traversable interface and foreach "kurtk@pobox.com" <kurtk@pobox.com> - 2014-05-23 11:22 -0700
Re: ArrayAccess interface, Traversable interface and foreach Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-23 16:35 -0400
Re: ArrayAccess interface, Traversable interface and foreach Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-24 12:05 +0200
Re: ArrayAccess interface, Traversable interface and foreach Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-24 07:09 -0400
Re: ArrayAccess interface, Traversable interface and foreach Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-24 14:37 +0200
Re: ArrayAccess interface, Traversable interface and foreach Adam Harvey <usenet@adamharvey.name> - 2014-05-27 18:59 +0000
Re: ArrayAccess interface, Traversable interface and foreach "kurtk@pobox.com" <kurtk@pobox.com> - 2014-06-02 07:15 -0700
csiph-web