5: Properties And Methods In Object Oriented PHP Programming | OOP PHP Tutorial | Learn OOP PHP

Properties And Methods In Object Oriented PHP Programming | OOP PHP Tutorial | Learn OOP PHP. In this PHP tutorial you will learn about properties and methods in classes, when it comes to object oriented PHP programming.


First of all, thank you for all the support you have given me!

I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!

I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful :)

Material for this lesson: https://www.patreon.com/posts/oop-php-5-lesson-16327182


M A Munayam says:

Clearly explained. Thanks

Samuel Torres says:

I love your OOP explanations! I really understand it, thank you for taking your time explaining concepts!

shailesh kumar says:

U r very good to explain everything

Finn Neraz says:

Are you working with clevertechie?

Sukhjit Multani says:


Alex Googlehead says:

How did he do that at 8:34, like he selected two rows and didn’t have to write 2 twice.

eduardo flores says:

Thanks a lot

Carl John Lopez says:

what if… i want to return 2 or more value..

Lakshan Perera says:

I have downloaded your whole OOP series and its very helpful. and i want to learn more about PHP programming from you !!!!!!!!!!

Daniel Ciobanu says:

bro you make this difficult

H Elnaka says:

very good explanation.. thank you

User30918 says:

I love that tutorial, you should start using single quotes tho. It doesn’t make sense, but bad habbits are bad habbits :)
$myVar = ‘My new text’;
$myVar = “My new text”;
Both work the same, except one thing. Using double quotes you can make something like:
$myVar = “My new text that i wrote for $name”;
$name = “Kevin”;
Will output/return = My new text that i wrote for Kevin.
But using single quotes it would be = My new text that i wrote for $name.
Is because double quotes use something (lets call it…) fetching function, that looks for a “$” inside a string to replace it to a string.
For 100 or 1000 viewers this doesn’t make a difference. But making a CMS like a Forum will affect the performance of your website.

Neil says:

These are amazing. A true gift to people learning around the world. You should have 100x the # of views.

jason teope says:

now i understand , thank very much baby

Xiaolin Chen says:

Thanks,man! Nice tuts!

Samuel Torres says:

I am getting the following error:

Notice: Undefined variable: data

I defined it just like in the video, any ideas?

Samuel Bartík says:

Please, create tutorials for MVC in PHP

Mesfin Ayenew says:

while the tutorial was nice , sublime cant work for me with the same code you work with , i cant help it! please ….some

Andrew Muhlfeld says:

Nice tutorials sir, I have a question what is the difference between with parameter and without parameter? what are the benefits and what if I do this?

class Profile {

public $Profile = [];
private $Name;
private $Age;
private $Gender;

public function getName() {

return $this->setName();


private function setName() {

$this->Name = $this->Profile[‘name’];

return $this->Name;


public function getAge() {

return $this->setAge();


private function setAge() {

$this->Age = date(“Y”) – $this->Profile[‘age’];

return $this->Age;


public function getGender() {

return $this->setGender();


private function setGender() {


if($this->Profile[‘gender’] === 1) {

$Sex = “Male”;

} elseif($this->Profile[‘gender’] === 2) {

$Sex = “Female”;

} elseif($this->Profile[‘gender’] !== 2 || $this->Profile[‘gender’] === 1) {

$Sex = “Rather not say”;


$this->Gender = $Sex;

return $this->Gender;



$Dipper = new Profile;

$Dipper->Profile = [

‘name’ => “Dipper Pines”,
‘age’ => 1999,
‘gender’ => 1


echo $Dipper->getName() . “

echo $Dipper->getAge() . “

echo $Dipper->getGender() . “

Dominus Providebit says:

Can anyone explain why he wrote
Public function setNewProperty ($newdata) {
$this->data = $newdata;


I am looking for the answer of why he placed the $newdata between the ().

laguna sir joseph says:

Thanks for these tutorials, they are much easier to understand than Codecourse ones :)

Артем Волков says:


DrHanna says:

whats the diffrent between this and self could u explain please

spicytuna08 says:

i am not convinced about OO at this stage yet. i can do same stuff using procedural but much simpler.

shailesh kumar says:

You r ossom sir

John o'meara says:

Excellent tutorials; very clear explanations. It’s all starting to make sense now! Cheers.

Write a comment


Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles   Show Cars   Motorbikes   Scooters   Rims & Tires   Luxury BoatsFashion   Sunglasses   Luxury Watches   Luxury Purses   Jeans Wear   High Heels   Perfumes   Jewellery   Cosmetics   Shaving Helpers   Fashion HatsFooding   Chef Club   Fooding Helpers   Coktails & LiquorsSports   Sport Shoes   Fitness & Detox   Golf Gear   Racquets   Diving Equipment   Ski Gear   Snowboards   Surf Boards   Rollers & SkatesEntertainment   DIY Guides   Zik Instruments   Published Books   Music Albums   Cine Movies   Trading Helpers   Make Money   Fishing Equipment   Paintball Supplies   Trading Card Games   Telescopes   Knives   VapesHigh Tech   Flat Screens   Tech Devices   Camera Lenses   Printers   USB Devices   PC Hardware   Network Gear   Cloud Servers   Software Helpers   Programmer Helpers   Mobile Apps   Hearing AidsHome   Home Furniture   Home Appliances   Beddings   Floor Layings   Barbecues   Aquarium Gear   Safe Boxes   Office Supplies   Security Locks   Cleaning ProductsKids   Baby Strollers   Child Car Seats   Remote ControlledTravel   Luggages & Bags   Airlines Seats   Hotel Rooms   Fun Trips   Cruise Ships   Mexico Tours