Testing Classes and Objects

We have already seen how we can use functions like gettype(), is_int(), and so on to test data types. This process is very useful in ensuring that functions are supplied with the right arguments.

The Reflection API

If you want to examine your script’s objects, methods, and properties in fine detail at runtime, you should look at another feature new to PHP 5. Discussing the Reflection API is beyond the scope of this book, but by the time you read this, documentation for it should be available in the manual at http://www.php.net/manual.

The Reflection API is a set of built-in classes with methods for discovering everything ...

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.