PHP
  Home arrow PHP arrow Introducing Static Members and Methods 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

Introducing Static Members and Methods in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 8
    2006-10-02


    Table of Contents:
  • Introducing Static Members and Methods in PHP 5
  • Static members and methods: an example
  • Implementing the Singleton design pattern
  • Building an array processing factory
  • Building an array processor factory continued

  • 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


    Introducing Static Members and Methods in PHP 5
    ( Page 1 of 5 )

    Static properties and methods can be quite useful in a range of situations, not merely for constructing a Singleton class. This article, the first in a two-part series, introduces the basic concepts of static properties and methods, using plenty of hands-on examples.

    Introduction

    Since its official release, PHP 5 has gained wide acceptance among PHP developers around the world, particularly in those cases where the natural evolution of web programming requires working with a robust object model. Not surprisingly, modern PHP 5-based applications now make intensive use of the broad range of features included with the last incarnation of the language, which in general leads to building better-crafted application layers.

    If you’ve been using the highly improved object model that comes with PHP 5 for a while, then you’ve possibly used static members and methods as an important part of your classes. This feature is very convenient to implement in those situations where a specific class member or method needs to be modified from outside the object context.

    Although at first glance, static properties and methods seem to be a minor topic to consider, the truth is that they can be quite useful in specific cases. Of course, one of the most common occasions where both static members and methods can be properly exploited is when constructing a typical Singleton class, but there are other cases too. Therefore, if you’ve been using pattern-based programming for building your PHP programs, you’ll know what I’m talking about.

    Considering the fairly huge range of applications where static properties and methods can be successfully used, in this two-part series, I’ll take an in-depth look at them. I will be introducing their basic concepts, as well as demonstrating their usage by copious hands-on examples.

    Hopefully, by the end of this series you should be equipped with a decent knowledge of how to include static members and methods within your PHP applications with minor difficulties.

    Want to know how the first chapter of this story begins? Click on the link below and keep reading. 



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

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





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