SlideShare a Scribd company logo
8/16/2013
Mutinda Boniface
Bsc. Information Technology
Computer Society of Kimathi (CSK) PHP MEETUP 2.0
Object Oriented Programming - PHP
OOP- PHP
8/16/2013
OOP? - What comes into your mind ?
1. Class..
2. Object..
1. Class..
2. Object.
3. Inheritance
4. Polymorphism
5. Data Hiding
OOP- PHP
8/16/2013
1. Class – A template that facilitates creation of objects,
- A set of program statements to do a certain task.
- Methods and properties
Example
properties constructor
methods
Represents an entity in a real world
OOP- PHP
8/16/2013
2. Object – Instance of a class
Example
new keyword to denote a new object of the class
object
Calls the class constructor if
It’s defined
OOP- PHP
8/16/2013
3. Inheritance – Parent and a child relationship
- Allows for reusability, extensibility
Nutshell: create a new class based on an existing class and
port in to it new methods and then later on create new
objects based on this class
Example
2 more methods
Inheritance is by the keyword extends in php
OOP- PHP
8/16/2013
4. Polymorphism – Objects react different to the same message
- implemented using keyword interface
- Solution since php doesn’t support multiple
in heritance
Example
Human being is an animal Dog is an animal
Human being can walk + dog can walk and so on….
See walk()
Implementation
for a human being
See walk()
Implementation
for a dog
This models out an animal interface whose methods
are implemented in classes which implements them
OOP- PHP
8/16/2013
5. Data Hiding – Limiting variables within or outside an object
- Demonstrates access control modifiers…
- public, protected, private
Example
See walk()
Implementation
for a human being
See walk()
Implementation
for a dog
This models out an animal interface whose methods
are implemented in classes which implements them
Public: member functions and properties defined as public are accessible
Within and outside the script.
Private: only accessible within the class it is defined in not outside
Protected: accessible within the class it is defined in and the descendants
Of the class.
OOP- PHP
8/16/2013
PHP 5 magic Functions
__get(), __set(), __toString(), __clone(), ………
Example
See walk()
Implementation
for a human being
See walk()
Implementation
for a dog
This models out an animal interface whose methods
are implemented in classes which implements them
__set() - it'll be called automatically by the PHP engine each time a
script attempts to assign a value to a property of a class that hasn't
been explicitly declared.
__get() - the "__get()" function will be invoked transparently when a
script tries to retrieve the value of an undeclared class property as
well.
OOP- PHP
8/16/2013
This models out an animal interface whose methods
are implemented in classes which implements them
1. Class keyword
2. Interface keyword
3. Implements keyword
4. Extends keyword
5. Magic functions __set(), __get(),…..
OOP- PHP
?
8/16/2013
OOP- PHP
8/16/2013
OOP- PHP
Email: boniface.info@gmail.com
Twitter: @webgeeker
Facebook: /mutinda.boniface

More Related Content

PPT
PHP - Introduction to Object Oriented Programming with PHP
PPTX
Polymorphism in java
PPT
Java packages
PDF
Introduction to Spring's Dependency Injection
PPT
Oops concepts in php
PPTX
Java Methods
PPTX
Basics of Object Oriented Programming in Python
PDF
JavaScript Promises
PHP - Introduction to Object Oriented Programming with PHP
Polymorphism in java
Java packages
Introduction to Spring's Dependency Injection
Oops concepts in php
Java Methods
Basics of Object Oriented Programming in Python
JavaScript Promises

What's hot (20)

PDF
Polymorphism In Java
PPS
String and string buffer
PDF
Java 8 Lambda Expressions
PPTX
polymorphism
PPTX
Polymorphism in Python
PPTX
Python oop third class
PPTX
C# Types of classes
PDF
Introduction to django framework
PPT
Introduction to method overloading & method overriding in java hdm
PPTX
Abstract Class & Abstract Method in Core Java
PPTX
Classes, objects in JAVA
ODP
Multithreading In Java
PPT
Design patterns ppt
PPT
JAVA OOP
PPT
Class and Objects in PHP
PDF
Java Thread Synchronization
PPTX
Python-Encapsulation.pptx
PPTX
Arrays in java
PDF
Collections In Java
PPTX
C# classes objects
Polymorphism In Java
String and string buffer
Java 8 Lambda Expressions
polymorphism
Polymorphism in Python
Python oop third class
C# Types of classes
Introduction to django framework
Introduction to method overloading & method overriding in java hdm
Abstract Class & Abstract Method in Core Java
Classes, objects in JAVA
Multithreading In Java
Design patterns ppt
JAVA OOP
Class and Objects in PHP
Java Thread Synchronization
Python-Encapsulation.pptx
Arrays in java
Collections In Java
C# classes objects
Ad

Viewers also liked (20)

PPTX
Object oreinted php | OOPs
ODP
Beginners Guide to Object Orientation in PHP
PDF
Threads in PHP - Presentation
PPT
Core Php Component Presentation
PPTX
PPTX
PHP in one presentation
PDF
Beginning OOP in PHP
PPTX
PHP presentation - Com 585
PDF
Devise | Presentation for Alpharetta PHP / Laravel Group
PPTX
PHP presentation
PDF
Object Oriented Programming in PHP
ODP
Internationalisation with PHP and Intl
PDF
Lean Php Presentation
ODP
Introduction of Html/css/js
DOC
Creating a Simple PHP and MySQL-Based Login System
PPTX
Php string function
PDF
PHP Tour 2016 Phinx Presentation
PPT
Oop Presentation
Object oreinted php | OOPs
Beginners Guide to Object Orientation in PHP
Threads in PHP - Presentation
Core Php Component Presentation
PHP in one presentation
Beginning OOP in PHP
PHP presentation - Com 585
Devise | Presentation for Alpharetta PHP / Laravel Group
PHP presentation
Object Oriented Programming in PHP
Internationalisation with PHP and Intl
Lean Php Presentation
Introduction of Html/css/js
Creating a Simple PHP and MySQL-Based Login System
Php string function
PHP Tour 2016 Phinx Presentation
Oop Presentation
Ad

Similar to Php oop presentation (20)

PPTX
Php oop (1)
PPTX
OOPS 46 slide Python concepts .pptx
PPT
Basic Oops concept of PHP
PPT
Introduction Php
PPTX
Oop's in php
PPTX
Oops in php
PPTX
c91632a4-2e92-4edf-b750-358da15ed1b1.pptx
PPTX
Lecture-10_PHP-OOP.pptx
PPTX
Constructor and encapsulation in php
PDF
Object_oriented_programming_OOP_with_PHP.pdf
PPT
Oops in PHP
PPTX
Shuvrojit Majumder . 25900120006 Object Oriented Programming (PCC-CS 503) ...
PPTX
Object oriented programming in python
PPTX
Lecture 12
PPTX
Object Oriented Programming
PPTX
OOPS IN PHP.pptx
PDF
Oops concepts
PPT
Oops in PHP By Nyros Developer
PPTX
Object Oriented Javascript part2
PDF
oop_in_php_tutorial_for_killerphp.com
Php oop (1)
OOPS 46 slide Python concepts .pptx
Basic Oops concept of PHP
Introduction Php
Oop's in php
Oops in php
c91632a4-2e92-4edf-b750-358da15ed1b1.pptx
Lecture-10_PHP-OOP.pptx
Constructor and encapsulation in php
Object_oriented_programming_OOP_with_PHP.pdf
Oops in PHP
Shuvrojit Majumder . 25900120006 Object Oriented Programming (PCC-CS 503) ...
Object oriented programming in python
Lecture 12
Object Oriented Programming
OOPS IN PHP.pptx
Oops concepts
Oops in PHP By Nyros Developer
Object Oriented Javascript part2
oop_in_php_tutorial_for_killerphp.com

Recently uploaded (20)

PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
01-Introduction-to-Information-Management.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Pharma ospi slides which help in ospi learning
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Lesson notes of climatology university.
PDF
Classroom Observation Tools for Teachers
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
A systematic review of self-coping strategies used by university students to ...
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Microbial diseases, their pathogenesis and prophylaxis
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Cell Structure & Organelles in detailed.
01-Introduction-to-Information-Management.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
O5-L3 Freight Transport Ops (International) V1.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pharma ospi slides which help in ospi learning
STATICS OF THE RIGID BODIES Hibbelers.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Lesson notes of climatology university.
Classroom Observation Tools for Teachers
Final Presentation General Medicine 03-08-2024.pptx
Anesthesia in Laparoscopic Surgery in India
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx

Php oop presentation

  • 1. 8/16/2013 Mutinda Boniface Bsc. Information Technology Computer Society of Kimathi (CSK) PHP MEETUP 2.0 Object Oriented Programming - PHP OOP- PHP
  • 2. 8/16/2013 OOP? - What comes into your mind ? 1. Class.. 2. Object.. 1. Class.. 2. Object. 3. Inheritance 4. Polymorphism 5. Data Hiding OOP- PHP
  • 3. 8/16/2013 1. Class – A template that facilitates creation of objects, - A set of program statements to do a certain task. - Methods and properties Example properties constructor methods Represents an entity in a real world OOP- PHP
  • 4. 8/16/2013 2. Object – Instance of a class Example new keyword to denote a new object of the class object Calls the class constructor if It’s defined OOP- PHP
  • 5. 8/16/2013 3. Inheritance – Parent and a child relationship - Allows for reusability, extensibility Nutshell: create a new class based on an existing class and port in to it new methods and then later on create new objects based on this class Example 2 more methods Inheritance is by the keyword extends in php OOP- PHP
  • 6. 8/16/2013 4. Polymorphism – Objects react different to the same message - implemented using keyword interface - Solution since php doesn’t support multiple in heritance Example Human being is an animal Dog is an animal Human being can walk + dog can walk and so on…. See walk() Implementation for a human being See walk() Implementation for a dog This models out an animal interface whose methods are implemented in classes which implements them OOP- PHP
  • 7. 8/16/2013 5. Data Hiding – Limiting variables within or outside an object - Demonstrates access control modifiers… - public, protected, private Example See walk() Implementation for a human being See walk() Implementation for a dog This models out an animal interface whose methods are implemented in classes which implements them Public: member functions and properties defined as public are accessible Within and outside the script. Private: only accessible within the class it is defined in not outside Protected: accessible within the class it is defined in and the descendants Of the class. OOP- PHP
  • 8. 8/16/2013 PHP 5 magic Functions __get(), __set(), __toString(), __clone(), ……… Example See walk() Implementation for a human being See walk() Implementation for a dog This models out an animal interface whose methods are implemented in classes which implements them __set() - it'll be called automatically by the PHP engine each time a script attempts to assign a value to a property of a class that hasn't been explicitly declared. __get() - the "__get()" function will be invoked transparently when a script tries to retrieve the value of an undeclared class property as well. OOP- PHP
  • 9. 8/16/2013 This models out an animal interface whose methods are implemented in classes which implements them 1. Class keyword 2. Interface keyword 3. Implements keyword 4. Extends keyword 5. Magic functions __set(), __get(),….. OOP- PHP
  • 11. 8/16/2013 OOP- PHP Email: [email protected] Twitter: @webgeeker Facebook: /mutinda.boniface