Re: is_array on objects with ArrayAccess or Iterator implementations
| From: | Richard Lynch | Date: | Tue, 29 Dec 2009 05:38:03 +0000 |
| Subject: | Re: is_array on objects with ArrayAccess or Iterator implementations | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46567@lists.php.net to get a copy of this message | ||
On Mon, December 28, 2009 10:30 am, Clint Priest wrote:
> Has there been any discussion or decision about whether is_array()
> should return true for objects which implement ArrayAccess or is there
> another function already available which checks for either being the
> case?
I really would prefer that is_array *not* return true unless something
really is a PHP array datatype.
I've had too much grief with psuedo-arrays from SimpleXML and/or SPL
or whatever it is that didn't quite implement *everything* an array
does, or didn't quite behave the way I expected with regards to
various functions.
Surely there can be some kind of is_a or instanceof or other operator
that would be more appropriate than overloading the built-in is_array
function.
--
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch