PHP
  Home arrow PHP arrow Handling Static Data 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

Handling Static Data with PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 6
    2007-09-11


    Table of Contents:
  • Handling Static Data with PHP 5
  • Building dynamic web page DIVs
  • Factoring DIVs using both conventional and dynamic methods
  • Putting all the classes together

  • 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


    Handling Static Data with PHP 5
    ( Page 1 of 4 )

    It's pretty common when using PHP to develop dynamic, object-oriented applications. Every so often, though, you need to work with static data. This article will explain how to work with static data and static properties, and show you how this ability can be useful in real-world situations.

    Introduction

    When you start learning some of the most important concepts for using the object-oriented paradigm with PHP, you quickly realize the remarkable benefits of building classes and objects, defining their methods and properties, and working with aggregation and composition as well.

    Of course, things get interesting when you begin applying the pillars of object-based programming, such as inheritance and polymorphism. At that point you've already acquired a decent background in developing dynamic, object-oriented PHP applications. I purposely used the term "dynamic" because it implies the existence of one or more classes that perform different tasks and output "dynamic" results.

    However, while defining a bunch of dynamic methods for a given class certainly is one of the most common process that a PHP developer has to tackle on a frequent basis, the truth is that the powerful object model offered by PHP 5 allows you to work with static data too, in a very approachable fashion. But, in the context of PHP programming…what does static data mean?

    Well, in simple terms, when a method of a class is declared static, it can be called from outside the object context, just like a conventional PHP function, thus avoiding the direct instantiation of that particular class. Pretty useful, right?

    Besides, there's more good news on the horizon, since PHP 5 does let you work with static properties, which means that when a class property is declared static, then it will be unique for the entire class, in this way being callable from outside the object context, and also shared by all the instances of that specific class.

    Perhaps, if you reread the above sentences, you may find the concept of working with static data in PHP 5 rather hard to grasp, or even pointless, but the truth is that in real world situations, this feature can be extremely useful. Therefore, and assuming that the subject of this series has already caught your attention, in this group of tutorials I'll be taking a close look at creating and using static properties and methods with PHP 5, and also provide you with numerous hands-on examples so you can acquire a solid grounding in this important topic.

    Are you ready to learn how to declare and use static data with PHP 5? Then don't you stay static; begin reading now!



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

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - 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





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