---
title: 'PHP OOP Tutorial Section 2 - Intro to Object Oriented Programming - Full PHP 8 Tutorial'
source: 'https://youtube.com/watch?v=1SujQeVK4MU'
video_id: '1SujQeVK4MU'
date: 2026-06-15
duration_sec: 0
---

# PHP OOP Tutorial Section 2 - Intro to Object Oriented Programming - Full PHP 8 Tutorial

> Source: [PHP OOP Tutorial Section 2 - Intro to Object Oriented Programming - Full PHP 8 Tutorial](https://youtube.com/watch?v=1SujQeVK4MU)

## Summary

This video introduces object-oriented programming (OOP) in PHP, contrasting it with procedural programming. It explains that a class is a blueprint and an object is an instance, highlighting OOP's benefits for code maintainability and structure. The video also clarifies that OOP does not automatically imply MVC and outlines topics to be covered in the section.

### Key Points

- **Course Context** [0:05] — This is the second section of the 'Learn PHP the Right Way' course, moving from procedural to object-oriented PHP.
- **Procedural vs OOP** [0:22] — Procedural programming divides an app into functions operating on global variables. OOP bundles related functions and variables into classes.
- **Class vs Object** [0:51] — A class is a blueprint; an object is an instance built from that blueprint. Multiple objects can differ slightly.
- **Advantages of OOP** [1:34] — OOP helps structure code for easier maintenance, testing, extension, and debugging, especially in teams.
- **OOP Not Automatic** [2:14] — OOP does not guarantee maintainable code; it's up to the developer to write clean, reusable code.
- **OOP vs MVC** [2:48] — OOP is a programming paradigm; MVC is an architectural pattern. OOP does not imply MVC.
- **Four OOP Principles** [3:14] — Encapsulation, abstraction, inheritance, and polymorphism are the main OOP principles.
- **Section Topics** [3:26] — Topics include classes, objects, magic methods, PSR standards, namespaces, autoloading, dependency management, traits, statics, sessions, cookies, and database connections.

### Conclusion

Object-oriented programming is a valuable skill for PHP developers, enabling better code organization and maintainability. The section will cover fundamental OOP concepts and practical topics like namespaces and database connections.

## Transcript

hello and welcome to the second section
of the learn php the right way course
in the first section of the course we
covered the core concepts of php like
data types casting control structures
functions and so on though most of the
things that we did in the first section
of the course we did it using the
procedural php
it is time to move on to object-oriented
php in procedural programming an
application or a program is divided into
a set of functions that operate on some
sort of data that are stored in
variables
so you basically have some sort of
global state or variables
and then bunch of functions that work
with those variables
you could also have functions called
other functions and so on in
object-oriented programming however
you're basically combining or bundling
related functions and variables into
something called a class
from which you create objects you could
access variables and call functions of
the object if they are publicly
available we refer
to the variables of the object or the
class as properties
and the functions as methods i mentioned
a class so what exactly is a class and
what's the difference between a class
and an object
in simple terms basically a class is a
blueprint and an object is something
that you create or build from that
blueprint you could have many objects of
the same class but each of those
objects can be different let's take a
house as an example the blueprint of the
house would be your class
and the house itself would be the object
you could have multiple houses based on
the same blueprint with slight
differences they can have different
paint colors they can have different
layouts and so on
in other words objects are simply
instances of the classes the main
advantage of object oriented programming
is the ability to structure your code in
a better way that is easier to maintain
test extend debug and so on though this
does not mean that procedural
programming is useless
there are some use cases for procedural
programming it might
be a good pick for a small project that
does not require many features or much
maintenance and you're the only one
working on it or maybe it's a simple
transcript
basically not everything has to be
object oriented but as your code grows
and your project requirements increase
you will find yourself in a trap where
modifying extending and maintaining that
code becomes difficult
especially when you're working in teams
this is where object-oriented
programming can help you but do note
that object-oriented programming does
not mean your code will automatically be
easier to maintain
essentially it is up to you as a
developer to ensure that you write your
code in a way that is maintainable
extendable readable and reusable
object-oriented programming just makes
it easier for you to
write such code also object-oriented
programming is on demand
meaning that you won't find many
companies looking for programmers with
experience in just procedural
programming most of them require
object-oriented programming skills thus
object-oriented programming mean
mvc no and this is the misconception
that i see a lot an object-oriented php
does not
automatically imply mvc object-oriented
programming is a programming paradigm
while mvc is an architectural pattern of
modal
view controller which uses the
object-oriented programming principles
and we'll talk about this more later in
the course but basically
object-oriented programming does not
imply mpc
object-oriented programming has four
main principles and these are
encapsulation abstraction inheritance
and polymorphism and we'll cover these
principles in detail in separate videos
so don't worry about them right now
let's talk a little bit about what you
can expect and learn from this section
of the course
in this section of the course we'll
cover how to create classes and objects
what are magic methods and go over the
use cases and examples
we'll cover code style and psr standards
namespaces autoloading and dependency
management we'll cover all four
principles of object-oriented
programming in more detail with actual
examples and of course we'll cover
things like
traits statics super global sessions
cookies connecting to databases and much
more and don't forget there is also a
third section of the course which will
cover much more advanced
topics so this is it for this video let
me know in the comments if you have any
questions or feedback
if you're looking forward to learning
more about php please give this video a
thumbs up which by the way helps a lot
with youtube's algorithm
share and subscribe and i'll see you on
the next video where we'll get php
installed using docker and start
exploring object-oriented php more
