Home arrow PHP arrow Magic Functions in PHP 5

Magic Functions in PHP 5

Itís not breaking news that the release of PHP 5 drastically changed the way that many developers build their web-based programs. The incorporation of a much more robust object model, along with the introduction of native exceptions, type hinting and so forth (add your own improvement to the list) has given the language the maturity that we see in it today. This seven-part article series will explain an important new feature: magic functions.

TABLE OF CONTENTS:
  1. Magic Functions in PHP 5
  2. Get and set functions: a quick overview
  3. Property overloading in action
  4. The set and get methods in action
By: Alejandro Gervasio
Rating: starstarstarstarstar / 12
May 26, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Among the new features introduced in PHP 5, magic functions are an important part of the whole enhancement process. They've also been rather overlooked by some programmers, either because of laziness or ignorance.

Despite their funny name, magic functions permit users to perform difficult tasks effortlessly. They can be powerful time-savers for loading resources automatically, or for overloading methods and properties of classes, to cite just two illustrative examples.

Naturally, for experienced developers, magic functions are an old creature they've long since tamed, but for beginners, learning how to use them in a true productive manner can be challenging experience -- especially when they're utilized during the development of object-oriented applications.

So, if you're a PHP programmer who wishes to learn how to master the basic concepts that surround the implementation and use of magic functions, then in this series of articles you'll find a comprehensive guide that will show you how to work with them, using a strong hands-on approach.

In the successive tutorials of the series, I'm going to cover the most relevant magic functions provided by PHP 5, starting with the "__set()" and __"get()" methods. Future parts will explore the "__call()", "__sleep() and "__wakeup() functions, and even later I will discuss the use of "__isset()", "__unset()", "__clone()", "__destruct()" and "__autoload()" respectively.

By the end of this series, you should be armed with a solid background in the theory of using magic functions. You'll also have practiced with a good number of concrete examples.

Now, it's time to leave the preliminaries start discovering the real power behind utilizing magic functions. Let's get started right away!



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- 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...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: