WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this Article to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES SUBMIT AN ARTICLE PRINT
Title : PHP and OOP
Categories : PHP, Object Oriented, Beginner Guides
Carlo Tasca
Carlo Tasca
Date : 2008-03-13
Grade : 0 of 5 (graded 0 times)
Viewed : 1088
Search : More Articles by Carlo Tasca
Action : Grade This Article
Tools : My Favotite Articles


  Submit your own code examples 
 


PHP is mainly a procedural programming language. Procedural programming is so called because the program code gives a set of instructions (i.e. an algorithm) for processing a particular task or set of tasks.



When programming in a procedural manner, the programmer usually breaks down the task/tasks in a top-down manner; this means the program will end up being made of a number of function calls, which can in turn call further functions or tasks.



In procedural programming data is of secondary importance and is normally placed into structures (data structures). As we would expect this data is global to the whole program, allowing us to see and access every function or procedure in the program, each of which will be able to change that data.



This is a very important concept; it means that whenever we change the format of any data structure in our program, all the other procedures and functions that operate on that data will also have to be changed. This can lead us to have to make numerous changes, something we really wouldn't like to happen when developing software of any type.





For around forty years, the idea of thinking about software in terms of objects surrounds us everyday, and indeed we make use of them almost everyday. For example clicking a button in your text editor to change the font color, wakes up the button object, which in turn tells other objects in the program that it had been clicked and that the font color must be changed. Also when we navigate the channels in our digital boxes to check when a tv programme had started, we may use objects, or better an object-oriented programming software, without knowing it.



The idea of having objects communicating with each other to get, give, and process data is the core concept behind programming in object-oriented manner.



At the end, if you think about it, this is what happens exactly in the real world. Although we cannot say we are objects, we surely can say that we do communicate with each other in order to gain information or give information, and sometimes we use the functions provided by a object to carry out one or more task.



Think for example when we make a phone call. We use the phone object to reach someone who is far away from us.



In OOP happens exactly the same and we may say that software objects simulates the part of real world that concerns an application. This is often called application domain or problem domain.



Most recent versions of PHP have increased their support for object-oriented programming, giving the tools to create objects' definitions and have them communicate with each other to run tasks for an application.



PHP, being a web scripting language and born as a procedural programming language, doesn't have all the features of pure object oriented programming languages such as Java and SmallTalk but, still, the possibility to create objects in PHP can bring huge benefits in the form of code design and organization and for the creation of more complex web applications. One of the biggest advantages of OOP versus procedural programming is the ability to promote re-use of code (to improve productivity), as well as being able to adapt methodologies like UML (Unified Modelling Language) and documentors (for PHP is phpdocumentor) to provide API documentation for libraries of classes.









PHP 101 Part 7 of 15 : The Bear Necessities
Categories : PHP, Beginner Guides, Object Oriented, PHP Classes
PHP Classes And Objects: A Guide To Development
Categories : PHP, PHP Classes, Object Oriented, Beginner Guides
Everything is an object
Categories : PHP, Object Oriented, Beginner Guides
How To add paging (Pagination) with PHP and MySQL
Categories : PHP, Beginner Guides, Databases, MySQL, HTML and PHP
Jump Start to Easy URLs
Categories : PHP, Beginner Guides, MySQL, File System, To PHP
PHP 101 Part 15 of 15 : No News Is Good News
Categories : PHP, Beginner Guides, Content Management
Beginners guide to PHP and MySQL
Categories : PHP, Beginner Guides, Databases, MySQL, Installation
PHP 101 Part 8 of 15 : Databases and Other Animals
Categories : PHP, Beginner Guides, Databases
Object Oriented Programming in PHP
Categories : PHP, Object Oriented
Beginners guide to PHP and MySQL - Creating a simple guest book
Categories : Beginner Guides, To PHP, To MySQL, PHP, MySQL
How TO Install PHP, Apache and MySQL on Linux or Unix
Categories : PHP, MySQL, Apache, Installation, Beginner Guides
PHP 101 Part 9 of 15 : SQLite My Fire!
Categories : PHP, Beginner Guides, Databases, SQLite
Making PHP Forms Object-Oriented
Categories : PHP, HTML and PHP, Object Oriented
Beginners Guide to PHP - Introduction to cookies
Categories : Beginner Guides, Cookies, To PHP, PHP
PHP5: Designing And Using Interfaces
Categories : PHP, Object Oriented, Interfaces, PHP Classes, Security