PHP Magic Features

Posted by sanjivl on Apr 15, 2009 2:32 AM EDT
Packt Publishing; By Jani Hartikainen
Mail this story
Print this story

In this article we'll look at PHP's "magic" features: Magic methods are class methods with specific names, are used to perform various specialized tasks. They are grouped into two: overloading methods and non-overloading methods. Overloading magic methods are used when your code attempts to access a method or a property which does not exist. Non-overloading methods perform other tasks. Magic functions are similar to magic methods, but are just plain functions outside any class. Currently there is only one magic function in PHP. Magic constants are similar to constants in notation, but act more like "dynamic" constants - their value depends on where you use them. We'll also look at some practical examples of using some of these, and lastly we'll check out what new features PHP 5.3 is going to add.

Full Story

» Read more about: Groups: PHP

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.