Home arrow PHP arrow Checking Native and User-Defined Classes with the Reflection API

Checking Native and User-Defined Classes with the Reflection API

Welcome to the final part of a series on the Reflection API. Through a decent variety of functional code samples, this series shows you how to take advantage of the power offered by reflection to analyze the internal structure of your classes and interfaces by using an object-oriented approach.

TABLE OF CONTENTS:
  1. Checking Native and User-Defined Classes with the Reflection API
  2. Review: a quick look at some previous examples
  3. Working with the isInternal() method
  4. Checking native and user-defined classes with the isUserDefined() reflective method
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
April 05, 2010

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

And now that you've been introduced to the main goal of this series, I'd like to spend a few moments refreshing the topics that were covered in the last article. In that tutorial I explained how to utilize a couple of methods included with the reflection API to determine if a specified class was declared abstract or final (or both) and if the class in question implemented a specified interface.

All of these reflective tasks were carried out by means of a clean object-oriented interface, which made the whole introspection process easy. Besides, the reflection API comes with many other handy methods that allow you to perform all sorts of reverse engineering processes on a given class. There are so many, in fact, that they can't all be covered in this series.

In this last tutorial, however,  I'm going to explain how to use reflection to find out whether a specific class is native or user-defined. And, if that's not good enough for you, you'll also learn whether the class can be traversed via a "foreach" construct.

Ready to tackle the final chapter of this educational journey on exploring the PHP 5 reflection API? Then start reading right now!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap

Dev Shed Tutorial Topics: