News Feed
Sections




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

Eric Lamb's Blog:
Practical PHP Reflection
March 04, 2011 @ 12:23:28

Eric Lamb came up against an interesting situation recently and found that PHP's Reflection API was the best thing to come to his rescue.

The perfect problem where the Reflection API appears to be the perfect solution. For me this came up a couple months ago while I was working on a European zip code radius project that had to be built using one of those obfuscated and ill documented 3rd party commercial programs (nothing worse than when the platform is forced on you). So, I had to use this program that was intentionally encoded to prevent me from doing what I wanted to do. I couldn't even look at the code; it was completely obfuscated.

To illustrate his point, he gives examples of two built-in classes that PHP has and the result of their reflected output - SimpleXMLElement and DateTime. He shows how to get the structure of the class in general and how to use some of the more specific functions to get things like properties, methods and constants for the class. This is perfect for those undocumented features and isn't too far of a jump away from building out your own documentation.

0 comments voice your opinion now!
api reflection detail class tutorial


blog comments powered by Disqus

Similar Posts

PHPMaster.com: Access Dropbox Using PHP

SitePoint PHP Blog: Using Solarium with SOLR for Search Advanced

WebSpeaks.in: Extract the Content of Zip file Using PHP

MrPHP.com.au: Image Cache using phpThumb and .htaccess

Hasin Hayder's Blog: Complete oAuth script for Twitter and LinkedIn using PECL oAuth Extension


Community Events





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


podcast framework tool release introduction opinion language version voicesoftheelephpant composer interview community security install update library series laravel symfony package

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