SlideShare uma empresa Scribd logo
1 de 7
Object Oriented PHP Jason Perry
What is it? A way of programming in PHP
Objects in PHP can’t be declared literally An instance must be created from a class.  class myClass{var $attribute1;var $attribute2;  function method1()  {    // Code here    return $something;  }  function method2()  {    // Code here  }} $myObject = new myClass();
What can it do? Organizes variables, functions, and information Shorten code to improve readability Add in an additional layer of functionality
Essentially creates a new variable User defined Can create as many of this type as desired Can access any attribute or method of the object Allows the creation of constructors which execute upon instantiation.  $myObject2 = new myClass();$myObject3 = new myClass();$myObject4 = new myClass(); // Attributes $myObject->attribute1 = ‘X'; $myObject->attribute2 = ‘Y'; // Methods $returned = $myObject->method1(); $myObject->method2();
Why use it? Increases ease of organizing longer projects Re-use of classes and variables Cuts back on repetitious typing of code Better organization of code Speeds up writing process Easier Maintenance
Citations http://nefariousdesigns.co.uk/archive/2006/08/object-oriented-php-part-1-definition/ http://webitect.net/development/phpmysql/object-oriented-php-the-basics/ http://net.tutsplus.com/tutorials/php/object-oriented-php-for-beginners/

Mais conteúdo relacionado

Mais procurados

Functions and Objects in JavaScript
Functions and Objects in JavaScript Functions and Objects in JavaScript
Functions and Objects in JavaScript Dhananjay Kumar
 
Advanced Interfaces and Repositories in Laravel
Advanced Interfaces and Repositories in LaravelAdvanced Interfaces and Repositories in Laravel
Advanced Interfaces and Repositories in LaravelJonathan Behr
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...Doug Jones
 
Variables, expressions, standard types
 Variables, expressions, standard types  Variables, expressions, standard types
Variables, expressions, standard types Rubizza
 
A Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpA Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpMichael Girouard
 
JavaScript Literacy
JavaScript LiteracyJavaScript Literacy
JavaScript LiteracyDavid Jacobs
 
Meta programming
Meta programmingMeta programming
Meta programmingantho1404
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - ObjectsWebStackAcademy
 
Dependency injection in CakePHP
Dependency injection in CakePHPDependency injection in CakePHP
Dependency injection in CakePHPmarkstory
 
Convention Generator - Yi’s Eclipse Monkey Scripts for Coding ActionScript in...
Convention Generator - Yi’s Eclipse Monkey Scripts for Coding ActionScript in...Convention Generator - Yi’s Eclipse Monkey Scripts for Coding ActionScript in...
Convention Generator - Yi’s Eclipse Monkey Scripts for Coding ActionScript in...Yi Tan
 
Ruby Metaprogramming
Ruby MetaprogrammingRuby Metaprogramming
Ruby MetaprogrammingThaichor Seng
 
Demystifying Object-Oriented Programming - Lone Star PHP
Demystifying Object-Oriented Programming - Lone Star PHPDemystifying Object-Oriented Programming - Lone Star PHP
Demystifying Object-Oriented Programming - Lone Star PHPAlena Holligan
 
Demystifying Object-Oriented Programming - Midwest PHP
Demystifying Object-Oriented Programming - Midwest PHPDemystifying Object-Oriented Programming - Midwest PHP
Demystifying Object-Oriented Programming - Midwest PHPAlena Holligan
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript TutorialBui Kiet
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHPVibrant Technologies & Computers
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in phpCPD INDIA
 

Mais procurados (20)

Effective PHP. Part 6
Effective PHP. Part 6Effective PHP. Part 6
Effective PHP. Part 6
 
Functions and Objects in JavaScript
Functions and Objects in JavaScript Functions and Objects in JavaScript
Functions and Objects in JavaScript
 
Java script basic
Java script basicJava script basic
Java script basic
 
Advanced Interfaces and Repositories in Laravel
Advanced Interfaces and Repositories in LaravelAdvanced Interfaces and Repositories in Laravel
Advanced Interfaces and Repositories in Laravel
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
 
Variables, expressions, standard types
 Variables, expressions, standard types  Variables, expressions, standard types
Variables, expressions, standard types
 
A Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpA Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented Php
 
JavaScript Literacy
JavaScript LiteracyJavaScript Literacy
JavaScript Literacy
 
Meta programming
Meta programmingMeta programming
Meta programming
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Dependency injection in CakePHP
Dependency injection in CakePHPDependency injection in CakePHP
Dependency injection in CakePHP
 
PHP- Introduction to Object Oriented PHP
PHP-  Introduction to Object Oriented PHPPHP-  Introduction to Object Oriented PHP
PHP- Introduction to Object Oriented PHP
 
Convention Generator - Yi’s Eclipse Monkey Scripts for Coding ActionScript in...
Convention Generator - Yi’s Eclipse Monkey Scripts for Coding ActionScript in...Convention Generator - Yi’s Eclipse Monkey Scripts for Coding ActionScript in...
Convention Generator - Yi’s Eclipse Monkey Scripts for Coding ActionScript in...
 
Ruby Metaprogramming
Ruby MetaprogrammingRuby Metaprogramming
Ruby Metaprogramming
 
Dci in PHP
Dci in PHPDci in PHP
Dci in PHP
 
Demystifying Object-Oriented Programming - Lone Star PHP
Demystifying Object-Oriented Programming - Lone Star PHPDemystifying Object-Oriented Programming - Lone Star PHP
Demystifying Object-Oriented Programming - Lone Star PHP
 
Demystifying Object-Oriented Programming - Midwest PHP
Demystifying Object-Oriented Programming - Midwest PHPDemystifying Object-Oriented Programming - Midwest PHP
Demystifying Object-Oriented Programming - Midwest PHP
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
 

Destaque

La publicidad en 140 carácteres. Diccionario de publicidad.
La publicidad en 140 carácteres. Diccionario de publicidad.La publicidad en 140 carácteres. Diccionario de publicidad.
La publicidad en 140 carácteres. Diccionario de publicidad.Sheila Losada
 
Why i like blogging most
Why i like blogging mostWhy i like blogging most
Why i like blogging mostmrslgresham
 
Reading Timetables
Reading TimetablesReading Timetables
Reading Timetablesjanmforman
 
Why i like blogging most
Why i like blogging mostWhy i like blogging most
Why i like blogging mostmrslgresham
 
πρόταση καταγραφής & αξιοποίησης των ακινήτων του δημοσίου
πρόταση καταγραφής & αξιοποίησης  των ακινήτων του δημοσίουπρόταση καταγραφής & αξιοποίησης  των ακινήτων του δημοσίου
πρόταση καταγραφής & αξιοποίησης των ακινήτων του δημοσίουvkazoukas
 

Destaque (7)

La publicidad en 140 carácteres. Diccionario de publicidad.
La publicidad en 140 carácteres. Diccionario de publicidad.La publicidad en 140 carácteres. Diccionario de publicidad.
La publicidad en 140 carácteres. Diccionario de publicidad.
 
Homenatge Dolors Thomas
Homenatge Dolors ThomasHomenatge Dolors Thomas
Homenatge Dolors Thomas
 
Why i like blogging most
Why i like blogging mostWhy i like blogging most
Why i like blogging most
 
Reading Timetables
Reading TimetablesReading Timetables
Reading Timetables
 
Why i like blogging most
Why i like blogging mostWhy i like blogging most
Why i like blogging most
 
R U N A L L A T E S T
R U N A L  L A T E S TR U N A L  L A T E S T
R U N A L L A T E S T
 
πρόταση καταγραφής & αξιοποίησης των ακινήτων του δημοσίου
πρόταση καταγραφής & αξιοποίησης  των ακινήτων του δημοσίουπρόταση καταγραφής & αξιοποίησης  των ακινήτων του δημοσίου
πρόταση καταγραφής & αξιοποίησης των ακινήτων του δημοσίου
 

Semelhante a Object oriented php

09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboardsDenis Ristic
 
Demystifying Object-Oriented Programming - ZendCon 2016
Demystifying Object-Oriented Programming - ZendCon 2016Demystifying Object-Oriented Programming - ZendCon 2016
Demystifying Object-Oriented Programming - ZendCon 2016Alena Holligan
 
Basic Oops concept of PHP
Basic Oops concept of PHPBasic Oops concept of PHP
Basic Oops concept of PHPRohan Sharma
 
Object Oriented Programming With PHP 5 #2
Object Oriented Programming With PHP 5 #2Object Oriented Programming With PHP 5 #2
Object Oriented Programming With PHP 5 #2Wildan Maulana
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptxrani marri
 
12-OO-PHP.pptx
12-OO-PHP.pptx12-OO-PHP.pptx
12-OO-PHP.pptxrani marri
 
Demystifying Object-Oriented Programming - PHP[tek] 2017
Demystifying Object-Oriented Programming - PHP[tek] 2017Demystifying Object-Oriented Programming - PHP[tek] 2017
Demystifying Object-Oriented Programming - PHP[tek] 2017Alena Holligan
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScriptDonald Sipe
 
Lecture 17 - PHP-Object-Orientation.pptx
Lecture 17 - PHP-Object-Orientation.pptxLecture 17 - PHP-Object-Orientation.pptx
Lecture 17 - PHP-Object-Orientation.pptxDavidLazar17
 
Introduction to OOP with PHP
Introduction to OOP with PHPIntroduction to OOP with PHP
Introduction to OOP with PHPMichael Peacock
 
Object Oriented Programming in PHP
Object Oriented Programming  in PHPObject Oriented Programming  in PHP
Object Oriented Programming in PHPwahidullah mudaser
 
Object Oriented Programming Basics with PHP
Object Oriented Programming Basics with PHPObject Oriented Programming Basics with PHP
Object Oriented Programming Basics with PHPDaniel Kline
 
Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5Stephan Schmidt
 

Semelhante a Object oriented php (20)

09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards
 
OOP in PHP
OOP in PHPOOP in PHP
OOP in PHP
 
Lecture9_OOPHP_SPring2023.pptx
Lecture9_OOPHP_SPring2023.pptxLecture9_OOPHP_SPring2023.pptx
Lecture9_OOPHP_SPring2023.pptx
 
Demystifying Object-Oriented Programming - ZendCon 2016
Demystifying Object-Oriented Programming - ZendCon 2016Demystifying Object-Oriented Programming - ZendCon 2016
Demystifying Object-Oriented Programming - ZendCon 2016
 
Introduction Php
Introduction PhpIntroduction Php
Introduction Php
 
Basic Oops concept of PHP
Basic Oops concept of PHPBasic Oops concept of PHP
Basic Oops concept of PHP
 
Object Oriented Programming With PHP 5 #2
Object Oriented Programming With PHP 5 #2Object Oriented Programming With PHP 5 #2
Object Oriented Programming With PHP 5 #2
 
Oops in php
Oops in phpOops in php
Oops in php
 
Demystifying oop
Demystifying oopDemystifying oop
Demystifying oop
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptx
 
12-OO-PHP.pptx
12-OO-PHP.pptx12-OO-PHP.pptx
12-OO-PHP.pptx
 
Demystifying Object-Oriented Programming - PHP[tek] 2017
Demystifying Object-Oriented Programming - PHP[tek] 2017Demystifying Object-Oriented Programming - PHP[tek] 2017
Demystifying Object-Oriented Programming - PHP[tek] 2017
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
Web 9 | OOP in PHP
Web 9 | OOP in PHPWeb 9 | OOP in PHP
Web 9 | OOP in PHP
 
Lecture 17 - PHP-Object-Orientation.pptx
Lecture 17 - PHP-Object-Orientation.pptxLecture 17 - PHP-Object-Orientation.pptx
Lecture 17 - PHP-Object-Orientation.pptx
 
Introduction to OOP with PHP
Introduction to OOP with PHPIntroduction to OOP with PHP
Introduction to OOP with PHP
 
Object Oriented Programming in PHP
Object Oriented Programming  in PHPObject Oriented Programming  in PHP
Object Oriented Programming in PHP
 
Object Oriented Programming Basics with PHP
Object Oriented Programming Basics with PHPObject Oriented Programming Basics with PHP
Object Oriented Programming Basics with PHP
 
Only oop
Only oopOnly oop
Only oop
 
Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5
 

Object oriented php

  • 1. Object Oriented PHP Jason Perry
  • 2. What is it? A way of programming in PHP
  • 3. Objects in PHP can’t be declared literally An instance must be created from a class. class myClass{var $attribute1;var $attribute2; function method1() { // Code here return $something; } function method2() { // Code here }} $myObject = new myClass();
  • 4. What can it do? Organizes variables, functions, and information Shorten code to improve readability Add in an additional layer of functionality
  • 5. Essentially creates a new variable User defined Can create as many of this type as desired Can access any attribute or method of the object Allows the creation of constructors which execute upon instantiation. $myObject2 = new myClass();$myObject3 = new myClass();$myObject4 = new myClass(); // Attributes $myObject->attribute1 = ‘X'; $myObject->attribute2 = ‘Y'; // Methods $returned = $myObject->method1(); $myObject->method2();
  • 6. Why use it? Increases ease of organizing longer projects Re-use of classes and variables Cuts back on repetitious typing of code Better organization of code Speeds up writing process Easier Maintenance