SlideShare une entreprise Scribd logo
1  sur  11
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

Contenu connexe

Tendances

Tendances (20)

Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Control Structures In Php 2
Control Structures In Php 2Control Structures In Php 2
Control Structures In Php 2
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Php introduction
Php introductionPhp introduction
Php introduction
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Data Types In PHP
Data Types In PHPData Types In PHP
Data Types In PHP
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Operators php
Operators phpOperators php
Operators php
 
Class 3 - PHP Functions
Class 3 - PHP FunctionsClass 3 - PHP Functions
Class 3 - PHP Functions
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Form Handling using PHP
Form Handling using PHPForm Handling using PHP
Form Handling using PHP
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1
 
Php operators
Php operatorsPhp operators
Php operators
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 

En vedette

PHP
PHPPHP
Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login System
Azharul Haque Shohan
 

En vedette (20)

Beginners Guide to Object Orientation in PHP
Beginners Guide to Object Orientation in PHPBeginners Guide to Object Orientation in PHP
Beginners Guide to Object Orientation in PHP
 
PHP Classes and OOPS Concept
PHP Classes and OOPS ConceptPHP Classes and OOPS Concept
PHP Classes and OOPS Concept
 
Threads in PHP - Presentation
Threads in PHP - Presentation Threads in PHP - Presentation
Threads in PHP - Presentation
 
Core Php Component Presentation
Core Php Component PresentationCore Php Component Presentation
Core Php Component Presentation
 
PHP
PHPPHP
PHP
 
PHP in one presentation
PHP in one presentationPHP in one presentation
PHP in one presentation
 
Php
PhpPhp
Php
 
Beginning OOP in PHP
Beginning OOP in PHPBeginning OOP in PHP
Beginning OOP in PHP
 
PHP presentation - Com 585
PHP presentation - Com 585PHP presentation - Com 585
PHP presentation - Com 585
 
Devise | Presentation for Alpharetta PHP / Laravel Group
Devise | Presentation for Alpharetta PHP / Laravel GroupDevise | Presentation for Alpharetta PHP / Laravel Group
Devise | Presentation for Alpharetta PHP / Laravel Group
 
PHP presentation
PHP presentationPHP presentation
PHP presentation
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
 
Internationalisation with PHP and Intl
Internationalisation with PHP and IntlInternationalisation with PHP and Intl
Internationalisation with PHP and Intl
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login System
 
Php string function
Php string function Php string function
Php string function
 
PHP Tour 2016 Phinx Presentation
PHP Tour 2016 Phinx PresentationPHP Tour 2016 Phinx Presentation
PHP Tour 2016 Phinx Presentation
 
Oop Presentation
Oop PresentationOop Presentation
Oop Presentation
 
Php string
Php stringPhp string
Php string
 

Similaire à Php oop presentation

Shuvrojit Majumder . 25900120006 Object Oriented Programming (PCC-CS 503) ...
Shuvrojit Majumder .  25900120006  Object Oriented Programming (PCC-CS 503)  ...Shuvrojit Majumder .  25900120006  Object Oriented Programming (PCC-CS 503)  ...
Shuvrojit Majumder . 25900120006 Object Oriented Programming (PCC-CS 503) ...
ShuvrojitMajumder
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptx
rani marri
 
oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.com
tutorialsruby
 
oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.com
tutorialsruby
 
Oop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.comOop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.com
ayandoesnotemail
 

Similaire à Php oop presentation (20)

Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
 
Basic Oops concept of PHP
Basic Oops concept of PHPBasic Oops concept of PHP
Basic Oops concept of PHP
 
Introduction Php
Introduction PhpIntroduction Php
Introduction Php
 
Oop's in php
Oop's in php Oop's in php
Oop's in php
 
Oops in php
Oops in phpOops in php
Oops in php
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
 
Object_oriented_programming_OOP_with_PHP.pdf
Object_oriented_programming_OOP_with_PHP.pdfObject_oriented_programming_OOP_with_PHP.pdf
Object_oriented_programming_OOP_with_PHP.pdf
 
Shuvrojit Majumder . 25900120006 Object Oriented Programming (PCC-CS 503) ...
Shuvrojit Majumder .  25900120006  Object Oriented Programming (PCC-CS 503)  ...Shuvrojit Majumder .  25900120006  Object Oriented Programming (PCC-CS 503)  ...
Shuvrojit Majumder . 25900120006 Object Oriented Programming (PCC-CS 503) ...
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in python
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptx
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
Oops in PHP By Nyros Developer
Oops in PHP By Nyros DeveloperOops in PHP By Nyros Developer
Oops in PHP By Nyros Developer
 
Object Oriented Javascript part2
Object Oriented Javascript part2Object Oriented Javascript part2
Object Oriented Javascript part2
 
oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.com
 
oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.com
 
Oop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.comOop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.com
 
Oop in php tutorial
Oop in php tutorialOop in php tutorial
Oop in php tutorial
 

Dernier

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Dernier (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

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: boniface.info@gmail.com Twitter: @webgeeker Facebook: /mutinda.boniface