PHP
  Home arrow PHP arrow Persistent Objects and Different Session Variables in 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

Persistent Objects and Different Session Variables in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2009-09-21


    Table of Contents:
  • Persistent Objects and Different Session Variables in PHP 5
  • Building a basic persistent class in PHP 5
  • Saving class instances to different session variables
  • Building a wrapping example

  • 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


    Persistent Objects and Different Session Variables in PHP 5
    ( Page 1 of 4 )

    Despite its rather intimidating name, persistent objects represent a pretty simple concept applied very often in software development. It's aimed at creating structured entities that can maintain their status across different stages of an application. This six-part series will take the mystery out of persistent objects so you can use them in your own applications.

    When using PHP 5 for developing web-based programs, creating this kind of object is even simpler. In most cases, the creation process is reduced to defining classes that are simply capable of keeping their state through several HTTP requests, in order to overcome the stateless nature of this protocol.

    Naturally, popular storage mechanisms long available on the web like database tables, text files and even cookies are frequently used to save instances of a class. This implies that some objects may be more persistent that others, even when this characteristic is only relevant in the context in which they’re utilized.

    However, as with many other topics related specifically to web development, building persistent objects in PHP 5 is a subject that’s definitely much better understood by example. So, in the first part of this series of articles I demonstrated how to define a basic class, which was provided with the ability to save an instance of itself to a predefined session variable, in this way maintaining its state across several web pages.

    There are, however, a few issues that must be fixed regarding the way that this persistent class was initially defined. First, it’s necessary to show how to restore an instance of the class on a different web page, and second, it must have the ability to use different session variables for saving its instances, thus enhancing its flexibility.

    Therefore, in this second installment of the series I’m going to show how to address the aforementioned issues. Let’s get started right now!



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

       

    PHP ARTICLES

    - Adding Ordering and Grouping Clauses to the ...
    - 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...





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