Static Properties & Methods In Object Oriented PHP - Full PHP 8 Tutorial

preview_player
Показать описание
In the first section of the course, you learned about variable scopes & static variables. In this lesson, you will learn about static properties & methods of the class with some use cases including singleton & factory design patterns. There are few differences between static properties & non-static properties, one is that static properties are associated & belong to the class itself & not to any particular object, while non-static properties are associated & belong to the object. So when you create an object, that object gets fresh values for the non-static properties. Another difference is that you need to use the dollar sign when accessing static properties, unlike regular properties where you don't use the dollar sign to access non-static properties.

SOME OF THE WAYS YOU CAN SUPPORT THE CHANNEL
👍 Smash the like button
🤝 Subscribe to the channel & turn the notifications on
💬 Post comments, any feedback is greatly appreciated
THANK YOU!

LESSON 2.7

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

Best PHP and complete course. Better than many paid bootcamps and best quality

federicobau
Автор

Dear Gio!
Your course is a masterpiece. It has been deeply thought out in terms of didactics. I have great respect for you for not succumbing to the curse of knowledge. A lot of professional teachers do this (they've forgotten what it's like to not know something) and it makes students like me really feel empowered and feel... a bit smart. In my humble opinion there are many advantages to your course, including:
- didactic order;
- substantiveness,
- lack of boasting and talkativeness,
- brevity and modest expression of recommendations,
- consequence,
- high quality video/audio material,
- a large amount of material,
- sharing on YT and not on Udemy.
Great respect Sir.
P.S.
Please continue this activity.
Your devoted subscriber.

damiankrupa
Автор

i am using php around 7 years but this course hit me hard in context of dunning kruger effect :)

erensrtky
Автор

20 years using PHP professionally, this course is AMAZING, the best PHP course I've found. My 2 cents: use a white theme, when trying to focus on the left side (IDE) I get a flash from the right side (browser), try it yourself, cover the right side with your hand you will see how you can focus better on the code on the left side.

Автор

each video learn so much i thought i already knew, professional and unique PHP series, thank you Gio, have best luck, you are top notch teacher!

basilistigris
Автор

Cool course, I'm waiting for the video lesson on microservices)

tolebiGamingTime
Автор

Just here to give you a like and maybe spread this course a bit more. Thanks

JohnnyBigodes
Автор

Thanks again for these informative and useful videos!

Vitalii-mr
Автор

Hi Gio! Thank you so much for these videos. They are an amazing resource. I'm in the process of upgrading a 5.4 codebase to php 8.x (haven't touched PHP since 5.4) and this content is golden. At first I was thinking of using Rector as way of automating the upgrade but where's the fun in that? I found your videos and (re)fell in love with PHP. <3

TurntableTV
Автор

Switching back and forth inside your videos while understanding PHP more and more I remembered your mention at 4:58 "The use of static methods and properties is generally considered a bad practice"

Now Laravel has these Facades - that as far as I understand - enable us to simply have a static counterpart of every of our classes/objects. Would be great if you could explain why this is a really good usecase. I guess there might be a new video on Facades in your laravel course?

btw.: I have not mentioned by now that also this video is great 🙂

lairotuT-Tutorial
Автор

A request : please do a video explaining method chaining, including static methods.
Thank you

jeevachaithanyansivanandan
Автор

I understand why you use static function as callback, but..., which would be an example of use case for not letting use "$this"?? I'm not seeing....
Great course!! Great videos!! Great explanations!! Great everything!! Please let me know if some day you do a course focus on Design Patterns
Thanks in advance

guillermofernandez
Автор

If you make a symfony course, I would totally buy it

ovidiublaga
Автор

Any thoughts on the idea of Singleton classes being an Anti-Pattern? Thanks for the great instruction, Gio!

migueldemaria
Автор

Great course packed with a lot of information. Just want to know from Gio and other people taking it, is required to code along with every lecture as I am a beginner to PHP and come from the background of Python so many concepts are new to me and if I am coding along one lecture take up to 30-40 minutes. If not what is the best way to do it.TIA

prashantgupta
Автор

Thanks bro for this great effort .
Can you please prefix videos with counting number, that will be great too . Thanks anyway ❤

AMoktar
Автор

Hello bro this hizqeel i think it would be great if you create playlist for OOP. love your content you have put everything in course

ezekielnizamani
Автор

If one is using a class like your Format example with only static methods, could one just as well just make an associative array called Format with the an appropriate name like “amount” as key, and a function as value?

Just a matter of taste, or is some better than the other for some kind of reason?

dawid_dahl
Автор

can you please give a real example on why we should user PRIVATE then making setters and getters instead of just using PUBLIC ?

aymanelash
Автор

Thanks a lot for this. Finished and I believe I'm following. Just that I wish I had some real project where I could be trying/applying this. Cause for now I'm just learning and learning. It's hard to test if I can recall and apply these. Maybe there's some code challenge or something online where I can test my knowledge. Is there? Great lesson. Thanks Gio

Zubbee