News Feed
Sections




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

NetTuts.com:
Reflection in PHP
April 19, 2013 @ 10:24:28

On NetTuts.com today there's a new tutorial talking about a part of PHP that can be quite powerful but isn't used too often - reflection in PHP. Using Reflection you can get information about your actual code and its elements without having to try to parse it yourself.

Reflection is generally defined as a program's ability to inspect itself and modify its logic at execution time. In less technical terms, reflection is asking an object to tell you about its properties and methods, and altering those members (even private ones). In this lesson, we'll dig into how this is accomplished, and when it might prove useful.

They provide a little context around the idea of "reflection" in programming languages and then jump right in with a few sample classes. They set up their "Nettuts", "Manager" and "Editor" classes and show how to use the ReflectionClass functionality to get their structure. The examples show how to get the class' methods, their properties and calling these methods using things like invoke and call_user_func.

0 comments voice your opinion now!
reflection tutorial introspection methods parameters invoke

Link: http://net.tutsplus.com/tutorials/php/reflection-in-php

blog comments powered by Disqus

Similar Posts

Jani Hartikainen's Blog: Refactoring explained to an absolute beginner

KillerPHP Blog: PHP Video: Processing Forms with PHP - part 2

Matthieu Napoli: Test against the lowest Composer dependencies on Travis

Norbert Mocsnik's Blog: Setting Up DokuWiki with Simple Authentication

phpDevelopment Blog: Zend Framework Tutorial Series: Part 3 – Login and Signup with (RE)Captcha


Community Events





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


unittest version introduction community laravel interview install composer extension api release symfony opinion configure series language podcast list conference voicesoftheelephpant

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