Hi,
Whenever you implement the Iterator interface the key method should only
return a scalar.
Is there any particular reason for this restriction.
IMHO I don't see any.
I also don't see why you can't index an array with object but it smells
something going wrong underneath.
Thanks
- Mathieu Suen
Hello,
Hi,
Whenever you implement the Iterator interface the key method should only
return a scalar.
Is there any particular reason for this restriction.
IMHO I don't see any.
The iterator interface was implemented on top of an API that
explicitly requested integers/strings as keys. It hasn't been changed
since.
I also don't see why you can't index an array with object but it smells
something going wrong underneath.
Historic reasons. Nothing would technically prevent objects from being
accepted as keys. Also, note that the SPLObjectStorage class can be
used for that task precisely. It is designed to work as an Object
Map/Set.
Thanks
- Mathieu Suen
--
--
Etienne Kneuss
http://www.colder.ch