PHP
  Home arrow PHP arrow Handling Static Data with PHP 5
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Developerworks
 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

Handling Static Data with PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    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:
      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

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    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


       · This first article of the series will explain how to work with static methods in PHP...
     

       

    PHP ARTICLES

    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery
    - Using Timers to Benchmark PHP Applications
    - Benchmarking Applications with PHP
    - Setting Up a Web-Based File Manager: PHPfile...
    - Developing a Modular Class For a PHP File Up...
    - Setting Up a Web-Based File Manager: bfExplo...
    - Defining a Custom Function for File Uploader...
    - Parsing Child Nodes with the DOM XML extensi...
    - Creating an Error Handling Module for a PHP ...
    - Accessing Attributes and Cloning Nodes with ...
    - Retrieving Information on Selected Files wit...
    - Handling HTML Strings and Files with the DOM...
    - Building File Uploaders with PHP 5
    - Working with Multiple Document Nodes with th...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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