background preloader

OOP

Facebook Twitter

SOLID Principles in PHP. Object-Oriented Bootcamp. Php-object-oriented-programming-fundamentals?_ga=2.166447610.536363831.1505736537-550908103. Code.tutsplus. Object Oriented Programming in PHP. We can imagine our universe made of different objects like sun, earth, moon etc. Similarly we can imagine our car made of different objects like wheel, steering, gear etc. Same way there is object oriented programming concepts which assume everything as an object and implement a software using different objects. Object Oriented Concepts Before we go in detail, lets define important terms related to Object Oriented Programming.

Class − This is a programmer-defined data type, which includes local functions as well as local data. Defining PHP Classes The general form for defining a new class in PHP is as follows − Here is the description of each line − Example Here is an example which defines a class of Books type − <? The variable $this is a special variable and it refers to the same object ie. itself. Creating Objects in PHP Once you defined your class, then you can create as many objects as you like of that class type. $physics = new Books; $maths = new Books; $chemistry = new Books; Destructor. Design Patterns in PHP.