News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Stuart Herbert's Blog:
Should is_array() Accept ArrayObject?
July 20, 2010 @ 10:08:09

In a quick blog post today Stuart Herbert asks the community at large a question - should is_array accept an ArrayObject?

Here's a quick question for the wider PHP programming community ' if you're writing code that tests for the presence of an array, should is_array() also accept objects that behave like arrays?

Some quick code snippets show that, currently in PHP 5.2, an is_array test will return false. If you use an instanceof to check it, however, you can get it to return true. There's plenty of comments on the subject with quite a few "no"s in the group.

0 comments voice your opinion now!
arrayobject isarray question instanceof


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: Tim Bray Explains Why Solaris in a Good Choice for PHP Developers

DevShed: Enforcing Object Types in PHP - Using the PHP5 instanceof Operator

International PHP Magazine: Poll Question: Which is the Most Important Feature of PHP 5?

PHP vs. .NET Blog: Ten PHP Best Practices Tips that will get you a job

International PHP Magazine: IPM Poll Question: Which is your Favorite CMS written in PHP?


Community Events





Don't see your event here?
Let us know!


tool security composer voicesoftheelephpant library artisanfiles introduction list language podcast laravel release version conference opinion interview symfony framework series community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework