I’ve got a Collection of closely related Objects. Before I add an Object to the collection, I want to check the class instance to make sure it’s OK.
Normally, I like all my objects in a collection to have a similar baseClass OR interface so I can use type hinting but in this case, the objects aren’t like that.
I like the way instanceof works. I don’t want to have to manage a list of namespaces.
Using the new 5.4 [] for array() syntax – create an array of valid classnames:
Next, create a function to test.