Home arrow PHP arrow Introducing Static Members and Methods in PHP 5

Introducing Static Members and Methods in PHP 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.

TABLE OF CONTENTS:
  1. Introducing Static Members and Methods in PHP 5
  2. Static members and methods: an example
  3. Implementing the Singleton design pattern
  4. Building an array processing factory
  5. Building an array processor factory continued
By: Alejandro Gervasio
Rating: starstarstarstarstar / 12
October 02, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: