PHP
  Home arrow PHP arrow User-defined Interfaces in PHP 5: Introduction to Core Concepts
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? 
PHP

User-defined Interfaces in PHP 5: Introduction to Core Concepts
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 12
    2005-12-19


    Table of Contents:
  • User-defined Interfaces in PHP 5: Introduction to Core Concepts
  • What are interfaces? Defining core concepts
  • The practical side: defining the “DeSerializer interface and “PostSaver” class
  • Making the Round Trip: defining the “MySQLCache” class
  • A functional example: using the “MySQLCache” and “PostSaver” classes

  • 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


    User-defined Interfaces in PHP 5: Introduction to Core Concepts
    ( Page 1 of 5 )

    PHP5 takes users increasingly in the direction of object-oriented programming. The Standard PHP Library (SPL) is a new item that helps developers both with the creation of OOP applications and the maintenance of standardization. The SPL enables developers to work with user-defined interfaces. In this article, the first of a series, Alejandro Gervasio uses examples to introduce you to working with these interfaces, which can keep you from having to reinvent the wheel with each new project.

    With the release of PHP5, a strong effort has been made to improve the existing Object Model available in previous versions of PHP. Taking PHP into the context of object-oriented programming was certainly a controversial topic, and very often the subject of many heated discussions. One recurring theme was the absence of relevant OOP features, available from long mature object-oriented languages such as Java or C++.

    In response to that, PHP5 brought in a wealth of brand new features, designed specifically to provide programmers with the capacity to develop more robust OOP applications, while maintaining a strong sense of standardization, particularly with the introduction of the Standard PHP Library (SPL) within the PHP5 core distribution.

    If you’ve already experienced the capabilities of PHP5, then you’re probably pretty familiar with the use of several PHP built-in interfaces such as “Iterator”, “IteratorAggregate” or “ArrayAccess” (to name the most popular ones) and some useful proprietary classes, like “ArrayIterator” or “ArrayObject”, aimed at solving standard problems.

    Aside from this impressive set of built-in features included within the SPL, PHP5 offers the possibility of working with user-defined interfaces, allowing a class to use any number of interfaces within program execution, by explicitly declaring them when the pertinent class is defined.

    In this tutorial, I’ll introduce the use of user-defined interfaces in PHP5, covering the basics of its theory along with the implementation of different examples, aimed specifically at demonstrating its functionality in real applications.

    Before we get started, a few items with be required. You should have at least a basic familiarity with the PHP5 syntax, along with an intermediate knowledge of concepts related to object-oriented programming. Therefore, having defined the objectives of the article, let’s move on to learning about user-defined interfaces in PHP5.



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

       

    PHP ARTICLES

    - 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
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT