PHP
  Home arrow PHP arrow Understanding Static Properties with 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? 
Google.com  
PHP

Understanding Static Properties with PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 7
    2007-09-12


    Table of Contents:
  • Understanding Static Properties with PHP 5
  • Reintroducing a previous hands-on example
  • Defining static properties within PHP 5 classes
  • Demonstrating the functionality of a static property

  • 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


    Understanding Static Properties with PHP 5
    ( Page 1 of 4 )

    The powerful object model offered by PHP 5 presents some useful features that are quite frequently underestimated by the average PHP developer. This is precisely the case with using static methods and properties in conjunction with the object-oriented paradigm, thus if you're interested in learning how to put static data to work for you, then this series of articles might be what you're looking for.

    Introduction

    Welcome to the second part of the series that began with "Handling Static Data with PHP 5". As you might guess, this series shows you how to take advantage of defining static properties and methods with PHP 5 classes, and it complements the corresponding theoretical concepts with several illustrative hands-on examples.

    If you already went through the first article of the series, then it's quite possible that working with static data in PHP 5 is now a familiar concept to you. In that tutorial, I demonstrated, by way of a few simple (yet functional) examples, how to use a static method to implement the factory pattern. In truth, the definition and further utilization of a static method within a factory class can be considered almost a rule of thumb when it comes to factoring different objects during a the execution of a given PHP application.

    The subject, however, goes by far beyond defining a static method as part of a simple factory class. And I'm saying this because admittedly, working with static data in PHP 5 might be incredibly useful in certain cases, a fact that you might not have been aware of until now. Thus, provided that you already have an average background in using static methods with PHP 5, over the course of this second article of the series I'll dive a bit deeper into this interesting  topic and show you how to take advantage of static properties defined inside a given PHP class, in this manner completing, at least basically, the implementation of static data with PHP 5.

    Even though the term "static" sounds like it refers to a thing that does nothing, in the new few lines you'll be hopefully surprised at the great range of PHP applications that can incorporate the remarkable benefits of using static properties in their classes.

    Having introduced the subject of this second installment of the series, it's time to step forward and continue learning with more examples of how to use static properties with PHP 5. It's going to be an educational journey, trust me!



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

       

    PHP ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - 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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek