PHP
  Home arrow PHP arrow Introducing Static Members and Methods...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
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: 5 stars5 stars5 stars5 stars5 stars / 7
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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


       · In this first article of the series, the basic concepts on using static properties...
     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway