SlideShare a Scribd company logo
OOPs in PHP By  Rajkumar
History of oops. What is oop system,Why do we have to use oops? Benfits of oops. Oop terminology. Oops in php4 and php5. Advantages and disadvantages of oops Concepts
History of oops Procedural language: The traditional programming that is based on algorithms or a logical step-by-step process for solving a problem. Web service is a platform independent.The focus of procedural programming is to break down a programming task into a collection of variables, data structures, and subroutines, whereas .The most important distinction is whereas procedural programming uses procedures to operate on data structures, object-oriented programming bundles the two together so an "object" operates on its "own" data structure .
History of oops Object oriented programming: in object-oriented programming it is to break down a programming task into objects  with each "object" encapsulating its own data and methods (subroutines). The most important distinction is whereas procedural programming uses procedures to operate on data structures, object-oriented programming bundles the two together so an "object" operates on its "own" data structure.
What is oop system? Main goal of oops is everything you want to do, do it in objects. Objects are basically small discrete pieces of code which,can incorporate data and behaves together. Oop system fallows bottom-up approach and divide & con-quire rule.
Features of oop system Encaptulation: Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class,thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding. Inheritence. Inheritance is the capability of a class to use the properties and methods of another class while adding its own functionality.
Polymorphism. Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Abstraction: Abstraction refers to the ability to make a class abstract in OOP. An abstract class is one that cannot be instantiated. All other functionality of the class still exists, and its fields, methods and constructors are all accessed in the same manner. You just cannot create an instance of the abstract class.
Benfits of oops Security.  Re usability  Maintainability  Portability.  Extendability.  Scalability.  Efficiency
Basic terminology Object. Class.  Access modifiers(public,private,protected). Access specifiers(static,final).  Methods/Functions. Variables/Attributes. Constructor/Destructor.
Examples <?php class Test{ private $a,$b; protected $x=12,$y=13; function add($a,$b){ $this->a =a; $this->b =b; return $a+$b; } }
class Test1 extends Test{ function add1(){ return $this->x + $this->y;  } } $obj = new Test(); $result = $obj->add(12,15); echo $result; $obj1 = new Test1(); $result1 = $obj1->add1(); echo $result1; ?>
 
Oops in php4 and php5 Basic object oriented concepts came in to existence in php3.But it is initiation for real oop. In php4 you can create objects but you can't feel real flavor of objects.  Everything is open in php4 (ie:no restrictions about usage of methods/properties). You can't use public,private,protected modifiers for your methods.  In php4 the private methods can be declared with __(double underscore).
Oops in php4 and php5 In php4 you can find interfaces but no abstract or final key word. In php4 you can access the methods without create an object. However it is not valid in php5 because the method echosomething() uses $this keyword which is not available in static call.
<?php class Abc {  var $ab;  function abc() {  $this->ab = 7;  }  function echosomething()  {  echo $this->ab;  } } echo abc::echosomething(); ?>
Oops in php4 and php5 Pass by value is in php4 where as pass by referrence is in php5. Exceptions handling came in to existence in php5. Unified constructor(__construct()) in php5. Exception hadling came in existence in php5.
 
Oops in php4 and php5 In php4 you can find interfaces but no abstract or final key word. In php4 you can access the methods without create an object. However it is not valid in php5 because the method echosomething() uses $this keyword which is not available in static call.
Advantages in OOPS Reusable blocks/code. Since it is in model it is easy to update aspects of your requirements. Allow many programmers on same project. Since it is segmented it allows many programmers to work on same project without fearing of breaking other users code. Good for bigger projects.
Disadvantages in OOPS It is not used for small projects because for object oriented we might have to write more code which would not be suitable for small projects. Object oriented in php can be little slower at run time. Difficult to learn for programmers used to procedural languages. A new way of thinking is required.
THANK YOU

More Related Content

PPT
Oops concepts in php
PPT
Oops in PHP
PPTX
Php oop presentation
PPT
Php Oop
PPTX
Object oriented programming in php 5
PPTX
Oops in php
PPTX
Object oreinted php | OOPs
Oops concepts in php
Oops in PHP
Php oop presentation
Php Oop
Object oriented programming in php 5
Oops in php
Object oreinted php | OOPs

What's hot (20)

PPTX
Oop in-php
PPTX
Introduction to PHP OOP
PDF
OOP in PHP
PPT
Introduction to OOP with PHP
PPTX
Intro to OOP PHP and Github
PDF
Intermediate OOP in PHP
PDF
A Gentle Introduction To Object Oriented Php
PPT
Class 7 - PHP Object Oriented Programming
PPT
PHP- Introduction to Object Oriented PHP
PPT
Class and Objects in PHP
PDF
Object Oriented Programming with PHP 5 - More OOP
PDF
Object Oriented Programming in PHP
PPTX
OOPS Characteristics (With Examples in PHP)
PPT
PHP - Introduction to Object Oriented Programming with PHP
ZIP
Object Oriented PHP5
PPT
Basic Oops concept of PHP
PDF
09 Object Oriented Programming in PHP #burningkeyboards
PPT
Intro to OOP and new features in PHP 5.3
PPTX
Basics of Object Oriented Programming in Python
Oop in-php
Introduction to PHP OOP
OOP in PHP
Introduction to OOP with PHP
Intro to OOP PHP and Github
Intermediate OOP in PHP
A Gentle Introduction To Object Oriented Php
Class 7 - PHP Object Oriented Programming
PHP- Introduction to Object Oriented PHP
Class and Objects in PHP
Object Oriented Programming with PHP 5 - More OOP
Object Oriented Programming in PHP
OOPS Characteristics (With Examples in PHP)
PHP - Introduction to Object Oriented Programming with PHP
Object Oriented PHP5
Basic Oops concept of PHP
09 Object Oriented Programming in PHP #burningkeyboards
Intro to OOP and new features in PHP 5.3
Basics of Object Oriented Programming in Python
Ad

Viewers also liked (11)

PPTX
PHP array 1
PPT
Php array
PPT
jQuery For Beginners - jQuery Conference 2009
PDF
CSS - OOCSS, SMACSS and more
PPTX
Cascading Style Sheets - CSS
PPTX
HTML, CSS and Java Scripts Basics
PPT
Html Ppt
PPT
Php Presentation
PDF
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
PDF
JavaScript Programming
PPT
Introduction to HTML
PHP array 1
Php array
jQuery For Beginners - jQuery Conference 2009
CSS - OOCSS, SMACSS and more
Cascading Style Sheets - CSS
HTML, CSS and Java Scripts Basics
Html Ppt
Php Presentation
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
JavaScript Programming
Introduction to HTML
Ad

Similar to Oops in PHP By Nyros Developer (20)

DOCX
Oops concept in php
PPTX
OOP Day 1
PPT
PPT
PHP-05-Objects.ppt
PDF
Demystifying Object-Oriented Programming #ssphp16
PPTX
Php oop (1)
PPTX
UNIT III (8).pptx
PPTX
UNIT III (8).pptx
PPTX
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
ODP
Object Oriented Programming With PHP 5 #2
PPTX
Object Oriented Programming using C++.pptx
PDF
Object Oriented PHP - PART-1
PDF
Procedural-vs-Object-Oriented-Programming (1).pdf
PDF
PDF
OOP in PHP
PPT
Go OO! - Real-life Design Patterns in PHP 5
PDF
OOP ppt.pdf
PPT
chapter - 1.ppt
ODP
(An Extended) Beginners Guide to Object Orientation in PHP
Oops concept in php
OOP Day 1
PHP-05-Objects.ppt
Demystifying Object-Oriented Programming #ssphp16
Php oop (1)
UNIT III (8).pptx
UNIT III (8).pptx
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented Programming With PHP 5 #2
Object Oriented Programming using C++.pptx
Object Oriented PHP - PART-1
Procedural-vs-Object-Oriented-Programming (1).pdf
OOP in PHP
Go OO! - Real-life Design Patterns in PHP 5
OOP ppt.pdf
chapter - 1.ppt
(An Extended) Beginners Guide to Object Orientation in PHP

More from Nyros Technologies (20)

PPT
MVC Architecture in ASP.Net By Nyros Developer
PPT
Web Designing Bugs - Fixes By Nyros Developer
PPT
Capistrano Deployment By Nyros Developer
PPT
Silver Light By Nyros Developer
PPT
Web 2.0 Design Standards By Nyros Developer
PPT
Web 2.0 By Nyros Developer
PPT
Caching By Nyros Developer
PPT
Language Integrated Query By Nyros Developer
PPT
New Features in .Net Framework 4.0 By Nyros Developer
PPT
Connect with Facebook to Rails Application By Nyros Developer
PPT
Github By Nyros Developer
PPT
Research on Audio and Video Streaming
PPT
User Interface
PPT
Audio and Video Streaming
PPT
Deploying Rails Apps with Capistrano
PPT
Capistrano - Deployment Tool
PPT
Social Networking
PPT
Payment Gateway
PPT
GIT By Sivakrishna
MVC Architecture in ASP.Net By Nyros Developer
Web Designing Bugs - Fixes By Nyros Developer
Capistrano Deployment By Nyros Developer
Silver Light By Nyros Developer
Web 2.0 Design Standards By Nyros Developer
Web 2.0 By Nyros Developer
Caching By Nyros Developer
Language Integrated Query By Nyros Developer
New Features in .Net Framework 4.0 By Nyros Developer
Connect with Facebook to Rails Application By Nyros Developer
Github By Nyros Developer
Research on Audio and Video Streaming
User Interface
Audio and Video Streaming
Deploying Rails Apps with Capistrano
Capistrano - Deployment Tool
Social Networking
Payment Gateway
GIT By Sivakrishna

Oops in PHP By Nyros Developer

  • 1. OOPs in PHP By Rajkumar
  • 2. History of oops. What is oop system,Why do we have to use oops? Benfits of oops. Oop terminology. Oops in php4 and php5. Advantages and disadvantages of oops Concepts
  • 3. History of oops Procedural language: The traditional programming that is based on algorithms or a logical step-by-step process for solving a problem. Web service is a platform independent.The focus of procedural programming is to break down a programming task into a collection of variables, data structures, and subroutines, whereas .The most important distinction is whereas procedural programming uses procedures to operate on data structures, object-oriented programming bundles the two together so an &quot;object&quot; operates on its &quot;own&quot; data structure .
  • 4. History of oops Object oriented programming: in object-oriented programming it is to break down a programming task into objects with each &quot;object&quot; encapsulating its own data and methods (subroutines). The most important distinction is whereas procedural programming uses procedures to operate on data structures, object-oriented programming bundles the two together so an &quot;object&quot; operates on its &quot;own&quot; data structure.
  • 5. What is oop system? Main goal of oops is everything you want to do, do it in objects. Objects are basically small discrete pieces of code which,can incorporate data and behaves together. Oop system fallows bottom-up approach and divide & con-quire rule.
  • 6. Features of oop system Encaptulation: Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class,thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding. Inheritence. Inheritance is the capability of a class to use the properties and methods of another class while adding its own functionality.
  • 7. Polymorphism. Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Abstraction: Abstraction refers to the ability to make a class abstract in OOP. An abstract class is one that cannot be instantiated. All other functionality of the class still exists, and its fields, methods and constructors are all accessed in the same manner. You just cannot create an instance of the abstract class.
  • 8. Benfits of oops Security. Re usability Maintainability Portability. Extendability. Scalability. Efficiency
  • 9. Basic terminology Object. Class. Access modifiers(public,private,protected). Access specifiers(static,final). Methods/Functions. Variables/Attributes. Constructor/Destructor.
  • 10. Examples <?php class Test{ private $a,$b; protected $x=12,$y=13; function add($a,$b){ $this->a =a; $this->b =b; return $a+$b; } }
  • 11. class Test1 extends Test{ function add1(){ return $this->x + $this->y; } } $obj = new Test(); $result = $obj->add(12,15); echo $result; $obj1 = new Test1(); $result1 = $obj1->add1(); echo $result1; ?>
  • 12.  
  • 13. Oops in php4 and php5 Basic object oriented concepts came in to existence in php3.But it is initiation for real oop. In php4 you can create objects but you can't feel real flavor of objects. Everything is open in php4 (ie:no restrictions about usage of methods/properties). You can't use public,private,protected modifiers for your methods. In php4 the private methods can be declared with __(double underscore).
  • 14. Oops in php4 and php5 In php4 you can find interfaces but no abstract or final key word. In php4 you can access the methods without create an object. However it is not valid in php5 because the method echosomething() uses $this keyword which is not available in static call.
  • 15. <?php class Abc { var $ab; function abc() { $this->ab = 7; } function echosomething() { echo $this->ab; } } echo abc::echosomething(); ?>
  • 16. Oops in php4 and php5 Pass by value is in php4 where as pass by referrence is in php5. Exceptions handling came in to existence in php5. Unified constructor(__construct()) in php5. Exception hadling came in existence in php5.
  • 17.  
  • 18. Oops in php4 and php5 In php4 you can find interfaces but no abstract or final key word. In php4 you can access the methods without create an object. However it is not valid in php5 because the method echosomething() uses $this keyword which is not available in static call.
  • 19. Advantages in OOPS Reusable blocks/code. Since it is in model it is easy to update aspects of your requirements. Allow many programmers on same project. Since it is segmented it allows many programmers to work on same project without fearing of breaking other users code. Good for bigger projects.
  • 20. Disadvantages in OOPS It is not used for small projects because for object oriented we might have to write more code which would not be suitable for small projects. Object oriented in php can be little slower at run time. Difficult to learn for programmers used to procedural languages. A new way of thinking is required.