If you’re a PHP developer who wishes to learn how to implement and use the set of magic functions that come included with PHP 5, you’ve come to the right place. Welcome to the third part of a series that takes a close look at magic functions in PHP 5. Made up of seven tutorials, this series teaches you how to work with the most common PHP 5 magic functions, putting particular emphasis on their usage within the context of object-oriented applications.
And now that you know what to expect from this group of articles, it's time to quickly review the topics that were discussed in the last one. In that installment of the series I explained by means of some examples how to work with the complementary "__isset()" and "__unset()" magic methods, which are called automatically by the PHP engine when using the "isset()" and "unset()" functions respectively.
Frankly speaking, those magic methods aren't the most useful provided by PHP 5, but there are others that do allow you to perform powerful tasks with minor efforts. That's exactly the case with the "__call()" function, which is invoked transparently by the PHP interpreter when a non-existent method of a class is called by a script.
As I said before, this function permits you to do all sorts of clever things, ranging from creating setters and getters on the fly to building mechanisms that catch calls to other defined class methods.
Therefore, as the title of this article suggests, in the new few lines I'm going to take a deeper look at the"__call()" function, so that you can quickly become familiar with it.
Are you ready to learn how to take advantage of this handy magic function? Then begin reading right now!