PHP
  Home arrow PHP arrow Magic Functions in PHP 5
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Magic Functions in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 8
    2009-05-26


    Table of Contents:
  • Magic Functions in PHP 5
  • Get and set functions: a quick overview
  • Property overloading in action
  • The set and get methods in action

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Magic Functions in PHP 5
    ( Page 1 of 4 )

    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.

    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
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT