Programming Basics
  Home arrow Programming Basics arrow Page 2 - Beginning Object Oriented Programming ...
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
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? 
PROGRAMMING BASICS

Beginning Object Oriented Programming in PHP
By: bluephoenix
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 132
    2003-11-11

    Table of Contents:
  • Beginning Object Oriented Programming in PHP
  • Objects - The Magic Box
  • Classes
  • Methods
  • Extends
  • Conclusion

  • 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


    Beginning Object Oriented Programming in PHP - Objects - The Magic Box


    (Page 2 of 6 )

    Imagine a box. It can be any type of box you want: a small jewelry box, a large crate, wooden, plastic, tall and thin, Short and wide...

    Next, imagine yourself placing something inside the box: a rock, a million dollars, your younger sibling...

    Wouldn't it be convenient if we could walk up to the box and just ask it to tell us what's inside instead of opening it ourselves? Actually, we can!

    <?php
    $mybox 
    = new Box("Jack");
    echo 
    $mybox-&gt;get_whats_inside();
    ?>

    Here the variable $mybox represents our self-aware box (also known as an object) which will be built by new--the world's smallest engineering and construction team. We also want to place Jack inside the box when it is built. When we want to ask the box it's contents, we'll apply a special get_whats_inside function to $mybox.

    The code won't run quite yet, though. We haven't supplied new with the directions for him and his team to construct our box and PHP doesn't know what the function get_whats_inside is supposed to do.

    More Programming Basics Articles
    More By bluephoenix


       · the tutorial is very clear &gt;&gt;really excellent
       · I liked the article.Does PHP4 support private/protected/public variables and...
       · I just got a good handle on how functions work and with this it just elevates to...
       · one of best explains i'v seen about objects..sorry for the english ...i speak...
       · DEAR SIR,I WANT TO KNOW ABOUT FUNCTIONS AND OOPS CONCEPTS IN PHP PLEAS REPLY TO MY...
       · thanx for the tutorial.. now I know how to use Class.....
       · Thanks for writing such a clear and concise introduction to OOP.I now feel...
       · This is a great article.I have never read such a great article on OOP in my life.The...
       · Nice article to understatnd OOPS. The English used to explain OOPS is very simple to...
       · I couldn't make it work until I made some changes, then I ended up doing some...
       · Fantastic tutorial! Well spoken!
       · your website displays displays greater than signs ( > ) as > and ampersands as...
       · I would like to thank you for writing such an excellent, concise and clear PHP OOP...
       · Very good tutorial very easy to understand and the analogies were excellent
       · In the code examples where text is rendered literally there is no need for the...
       · So, now I understand OOP a little better, can you explain the action of -> using...
       · I'm guessing you are a windows fan. I'd like to pass on to your many, many...
       · I have read lots of them and this is the first I have ever commented on. It was easy...
       · This was a very basic explanation and potentially helpful to anyone who knows the...
       · this is very very very wst knlwdg of OOPS where is orgi basics of OOPS
       · Excellent turtorial on PHP OOP concepts for a beginning PHP procedural...
       · n i must say...ur mind blowing!!!u made my some chunk of time ..quite...
       · Google adds covered the text of the tutorial on one page and covered part of the...
     

    PROGRAMMING BASICS ARTICLES

    - PHP: Hypertext Preprocessor: What is it?
    - Loops and PHP Decision Making
    - Operators, Conditionals, and PHP Decision-Ma...
    - PHP Decision-Making
    - Coding
    - Server Statistics
    - Looping in PHP
    - Cookies in PHP
    - Working with text files
    - Beginning Object Oriented Programming in PHP
    - A Tour of Decision Making Structures in PHP
    - PHP Strings Primer
    - PHP Control Structures
    - Intro to Vim
    - Reading Directorys with PHP





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