Re: Objects as array key names??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



another developer brought to my attention the spl method spl_object_hash()
method which afforded a mod in the previously posted class whereby foreach
could be used properly.  also, it allows a more efficient internal
implementation.  however, to my dismay, it appears that implementing
ArrayAccess does not (not just in this scenario, but in any) allow the class
which does so to hook into the global array methods such as array_keys() or
array_key_exists().  in this sense, i see it as being only about halfway as
useful as it could (or should) be.
what i see ArrayAccess in php as, is something quite similar to properties
in vb.net, if anyones familiar w/ that.
http://www.vbdotnetheaven.com/Uploadfile/rajeshvs/PropertiesInVbDotNet04192005060237AM/PropertiesInVbDotNet.aspx

this is the second scenario where i think there could be c code in php
itself that would override standard behavior provided an spl definition in
user space.  sure, the internal code would run a bit slower but imagine
wrapping it in #ifdef directives and mapping those to a configure flag
whereby if spl wasnt enabled that code wasnt included.  i think that would
be adequate and it would allow spl to be even more powerful, giving php
programmers the ability to more dramatically, semantically modify the core
w/o writing a scrap of low-level code.

if anybody cares, im happy to send the code for the revision of ObjectArray
that allows usage of the foreach construct over instances of it.

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux