Web Design and Programming Pt 10 PHP & OOP

preview_player
Показать описание
Here I cover Object Oriented PHP. I explain encapsulation, classes, objects, public, private, constructors, destructors, __set, __get and more.

Рекомендации по теме
Комментарии
Автор

@JamesRCoston Yes, I've read all of the books that supposedly cover OOP in PHP. PHP isn't a OOP language, but it does allow you to implement some oop principles. I'll get into how you can incorporate design patterns into php some day. That is actually pretty useful.

derekbanas
Автор

@sethchilds Constants can't have access specifiers like private, public or protected. They also can only have either the value of a string or number. The constant is part of the class definition and not the objects that you create. That's why you use the scope operator (::) to access it. Hope that helps. Thanks

derekbanas
Автор

@SamuelLockyer I really liked the Larry Ullman book on PHP. I pretty much learned everything else through experience over the years. Yes there are tons of different ways you can use the magic methods. I don't use them very often in day to day coding though

derekbanas
Автор

These videos are excellent, and much appreciated. You are right about books not covering __set and _get thoroughly. __construct and __destruct are relatively clear, but the other 2 magic methods are for more confusing, and are barely covered in the THREE books I own. Thanks again!

durnik
Автор

@sondano Thanks for pointing that out. Deciding on what versions to do tutorials on is often my biggest decision.

derekbanas
Автор

@metardd Thanks. Most people on you tube are trying to make money. That's why they make a ton of short tutorials. The more views they get, the more money they make. I don't think it's conducive to actually learning though. Drupal is just php, JavaScript and jquery like wordpress. As soon as I can I'll cover it.

derekbanas
Автор

@robotworkz Thank you. I'm glad you like them

derekbanas
Автор

@metardd I can do that eventually. I'm kind of backed up. I did the only tutorials on making wordpress themes and plugins from scratch. You may like those. They are free on my yt channel :)

derekbanas
Автор

@SamuelLockyer The only way you'll learn to program is through practice. A professor will teach you the basics, efficient coding and design patterns. In the real world you don't have time to be perfectly efficient and if you're working in a group you can't trust that everyone will understand your design patterns. If I was you I would set a goal that you want to make Facebook. It actually isn't very hard. By the end of that project you'll know more about programming than your teacher :)

derekbanas
Автор

There were a few tips here that helped me a lot. Thanks

CustomizeWordpress
Автор

PHP and MySQL Web Development Fourth Edition has amazing coverage of OOP in PHP. I suppose the lack of coverage in books is due to how young the OO functionality is in PHP.

JamesRCoston
Автор

I really like your tutorials. Is there any way you can do a series on Drupal? Specifically how to create your own Drupal module. I can't seem to find any video tutorials on it, for free at least.

metardd
Автор

@derekbanas Yeah I noticed that you did some Wordpress tutorials but I'm trying to become a Web Developer and I've decided that I will focus on Drupal cause I'm already familiar with that cms since all my personal websites I have set up using Drupal. So I already know a few things about drupal but I don't know how to make custom modules. I really like your style of teaching, I find that it's easier to understand the way you do it compared to other folks who do tutorials.

metardd
Автор

ur class is very interesting
thankyou

Healthy_exercise_yoga
Автор

when you change $name to also private instead of public, why do the constructors get called twice:
__construct was called
__set was called for name
__get was called for name
__set was called for age
__get was called for age
9
The dogs name is Grover
The dogs age is 9
The pounds ID number is 12345
__destruct was called

alexandershekhtman
Автор

There are no links between __set, __get with setAge, getAge. How does it work?

DmitriuTT
Автор

I'm getting a warning and notice messages for some reason. Everything is working fine.

Warning: Missing argument 1 for Animal::__construct(), called in on line 54 and defined in C:\.... on line 29
Notice: Undefined variable: age in C:\.. on line 31

MrLangam
Автор

No because php isn't an oop language, but you can fake it

derekbanas