What Is Late Static Binding & How It Works In PHP - Full PHP 8 Tutorial

  Рет қаралды 24,034

Program With Gio

Program With Gio

Күн бұрын

In this video, you'll learn what early & late binding are as well as what late static binding is. By the end of this video, you will also know the problem with statics when it comes to inheritance & how late static binding solves that problem.
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
⭐ Become a Patreon: / programwithgio
THANK YOU!
LESSON 2.13
Course Outline - github.com/gge...
Course Playlist - • Learn PHP The Right Wa...
RESOURCES
Lesson About Static Properties & Constants - • Static Properties & Me...
Resources - www.php.net/ma...

Пікірлер: 97
@federicobau8651
@federicobau8651 2 жыл бұрын
best php course, better than paid bootcamps
@mwaas
@mwaas Жыл бұрын
Best explanation ever I hope you reach a million subscribers one day because you provide fabulous content
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you so much 💙
@donmikele07
@donmikele07 2 жыл бұрын
I watched so many tutorials about different technologies but this sounds as the highest level of knowledge, skill set and the way of explanation and expression. Really damn great job!!!!! BTW: I had a discussion with my team leader. He always likes to be right. I claimed and still claim that in late static binding the 'static' keyword is used in the parent class and 'self' in the child class. He claims that 'static' must be present in both classes and that 'self' must not be used in either class. That makes no sense to me. I would like to hear your opinion (although everything can be seen from this video).
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you so much 💙💙. To answer your question, there is no strict rule that "static" has to be used in parent or child. It should be used where late static binding is needed. Same goes for self, it can be used whenever you don't need late static binding, if you don't use inheritance then using self is fine. Your team lead may have a specific reason on why he enforces usage of static, have you asked him?
@donmikele07
@donmikele07 2 жыл бұрын
@@ProgramWithGio thank you so much. I'll check that and let you know.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@donmikele07 no problem 👍
@OlgaFB1
@OlgaFB1 Жыл бұрын
I agree
@benderbg
@benderbg 3 ай бұрын
This lecture was intense but that is how we like it. Thanks Gio!
@ProgramWithGio
@ProgramWithGio 2 ай бұрын
Yup, moving onto more challenging topics. You got this 💪
@rqqg
@rqqg 3 жыл бұрын
Man, I'm used to read the documentation but you make it so much easier and faster to pick up on everything, I'd triple like every vid if I could, alas ony have 2 accounts lol
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
I'm super happy to hear that, thank you 🙏
@victorisrael6191
@victorisrael6191 3 жыл бұрын
Your tutorials are strictly for the elites that will become good php programmers😌..........you teach us what youtubers don't talk about
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
It's for all kinds of levels. I try to teach the way I would want to learn. These are the type of stuff you will encounter at work so I want to make sure I cover it with enough detail
@2008rol
@2008rol 3 жыл бұрын
Wonderful tutorial.Finally I understand the difference between self and static. Keep going and I really enjoy all of your tutorial
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Glad to hear that, thank you 🙏
@yinonelbaz5309
@yinonelbaz5309 Жыл бұрын
Wow!!! What an amazing explanation!!!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 🙏
@Vitalii-m6r
@Vitalii-m6r Жыл бұрын
This concept is quite hard to grasp but you explained it very well. Thanks!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Happy to hear it was helpful 💙
@hakeamgureh2441
@hakeamgureh2441 3 жыл бұрын
I still don't understand that thumbs down on this video. Thank you Gio for this great content. Am a big fan of your chanell and share your contents with friends and PHP groups. Continue being awesome as usual and know that you are appreciated. Don't be discouraged and dispirited am 100% sure this channel will be a big hit for PHP ninjas. Do a detailed laravel beginner 101 course like this one, unearthing the basics that other courses skip. Do same on core basics on javascript too and how it works and put it on udemy for full course and snapshots on youtube for marketing. Will buy and definitely anyone on udemy. Definitely deserved. Continue being awesome man.One❤
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you so much Hakeam 🙏. I certainly don't get discouraged cause of few dislikes, don't worry 🙂. I understand that someone may not like or agree with my content and that is perfectly fine. Also there are ton of bots that auto dislike stuff so not a big deal. If someone has an issue I would hope they would post a comment raising concerns and I would be happy to clarify or answer. I'm planning on more Laravel content soon 👍
@TomiBorchert
@TomiBorchert 2 жыл бұрын
wow, ppl have different opinions and thoughts, welcome to the real life. Get used to it.
@coder236
@coder236 Жыл бұрын
incredible tutorial on this, thanks for taking the time to make these videos
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad you liked it, thank you 🙌
@graceman999
@graceman999 Жыл бұрын
This is perfect! 😃really well explained, thanks
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 🙏
@aleksandrkanygin2672
@aleksandrkanygin2672 3 жыл бұрын
Thank you, that's a very useful course
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
You're welcome & thank you 👍
@mohammadfaisalabdullah1316
@mohammadfaisalabdullah1316 Жыл бұрын
Only if I had an instructor like you back in my university days
@ProgramWithGio
@ProgramWithGio Жыл бұрын
💙💙
@invgreat5608
@invgreat5608 Жыл бұрын
Goddamn, man. Hard topic, and you've dealt with it perfectly. Thank you!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you, glad you liked it 🙌
@TricoliciSerghei
@TricoliciSerghei 3 ай бұрын
Very nice explanation, thank you very much!!
@ProgramWithGio
@ProgramWithGio 3 ай бұрын
You are welcome!
@techatival
@techatival 3 жыл бұрын
Keep going, don't give up!
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
That's the plan!
@Zubbee
@Zubbee 2 жыл бұрын
I understand quite well even though I long to understand in practice too. Let me keep forging ahead. Thanks Gio
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
That's awesome, like following your journey
@Zubbee
@Zubbee 2 жыл бұрын
nice of you to say that Gio. It's tough though...
@giotapetrou2801
@giotapetrou2801 Жыл бұрын
thank you so much!! the work you have done is amazing!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're very welcome 🙌
@ShortFilmVD
@ShortFilmVD 3 жыл бұрын
Very well explained 👍
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you
@karam0101
@karam0101 2 жыл бұрын
Another great tutorial. Thank you for sharing all these concepts
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@Mahmudulhasan-ts5hm
@Mahmudulhasan-ts5hm 3 жыл бұрын
Thanks
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
You're welcome
@saugmaddox349
@saugmaddox349 3 жыл бұрын
Sir please make a video on php attributes introduced in php 8
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Yup, PHP8 attributes feature will be covered in this course, a bit later though
@adrianez-programuj3313
@adrianez-programuj3313 3 жыл бұрын
Nice Job!
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thanks 🙌
@rosarioveneruso9928
@rosarioveneruso9928 3 жыл бұрын
Hi Gio , what do we intend exactly with "resolving a class" or "class resolution"?Also , for non native speaker like me , what is binding in general in php exactly?
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Hello, resolving basically means loading the class & all of its dependencies. Binding can mean different things in different contexts. For example in terms of variable bindings they get associated with some sort of identifier internally that reference the object, you can think of it as scoping as well if that helps.
@ryanford516
@ryanford516 2 жыл бұрын
@@ProgramWithGio thanks, Gio! But honestly... I still don't understand it at all. I mean, the effects of using the "static" keyword in your video are clear because you illustrate it with multiple examples. However, I still don't get the terms used throughout the video. As pointed out, binding can mean various things in different contexts but what about this particular context? In other words, what gets bound to what in your specific code? If it's a topic too vast to cover in a single comment, could you please recommend some beginner-friendly resource that can clear things up?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@ryanford516 no problem. Don't overthink the term "binding", think of it as variable being bound to its value like object. It can happen at different times. Not sure what resource I can suggest about it, you can try googling more about late static binding.
@alexios4392
@alexios4392 3 жыл бұрын
Nice! It's popular interview question :D
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Yup 🙂
@alexios4392
@alexios4392 3 жыл бұрын
@@ProgramWithGio It would be great if each episode could have gist or repo code to see :)
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
@@alexios4392 some later episodes have link to repo
@memack101
@memack101 2 жыл бұрын
Thank you.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome!
@ilya_123__
@ilya_123__ Жыл бұрын
thank you!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome!
@hiranyasarma8886
@hiranyasarma8886 2 жыл бұрын
Nice explanation. :)
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you
@twentxx
@twentxx Жыл бұрын
Thanks a lot 👏
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome 🙌
@saidzihmmou6426
@saidzihmmou6426 2 жыл бұрын
well explained!
@benjaminvenezia1944
@benjaminvenezia1944 Жыл бұрын
Hey Gio, thank's for this great content! At 9:39, why are your returning static() and not static (without parentheses), it works the same in my IDE in both cases! Thank's for all you're doing, it's awesome!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Hello, thank you. No particular reason, just a habit & preference. I do same with regular class instantiations like new Invoice() vs new Invoice when no arguments are needed for the constructor. To me it makes sense to have parenthesis because it invokes a method in this case a constructor which is still a method call and method calls have parenthesis
@benjaminvenezia1944
@benjaminvenezia1944 Жыл бұрын
@@ProgramWithGio Thank's!
@RafaelCeballo
@RafaelCeballo 2 жыл бұрын
Hey Gio, I want to thank you for this awesome PHP Tutorial I'm learning alot. I'm going to learn Laravel after using Laracast. Do you think I'll need to watch the whole 110 videos to jump into laracast ? If not, can you tell me the video number where I should be ready ? Thanks again!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Hey. You're welcome, happy to hear that you are learning alot. It depends on your level and if you feel comfortable starting Laravel. You can start it and if things seem hard or complicated then come back and continue watching the videos here. I personally would at least finish 3rd section because we cover some important topics there. Up to you though 👍
@arbonkastrati8967
@arbonkastrati8967 2 жыл бұрын
Hey Gio, thanks a lot for your great content, a really appreciate your efforts on providing us this high quality knowledge! One thing that i find a bit hard to understand and that there isn't much of information out there , is the idea of forwarding-call and non-forwarding call, could you please give us some thoughts on this?!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Hello, thank you 🙏. I talked about it a little bit at around 6:12. Also the 2d paragraph in PHP docs explains it as well: www.php.net/manual/en/language.oop5.late-static-bindings.php
@johongirrahimov2343
@johongirrahimov2343 3 жыл бұрын
***SUMMARY*** So self inside Class always refers to that Class self is used in static inside method refers to Class that called that method static is in
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@binhphan6321
@binhphan6321 Жыл бұрын
Good tutorial. I don't understand some points, could you explain them to me? The difference between static and $this variable in a non-static context is that: if you call the method using the $this variable, it could call a private method from the same scope while using static could result in a different method call.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thanks. If you had a private method in the same class & you used $this it would call that method from the same class, however with static:: it may call the parent one depending on where its called from
@binhphan6321
@binhphan6321 Жыл бұрын
Thanks for your explanation@@ProgramWithGiobut it's still unclear to me. Let me give an example: class ClassA1 { public function showClassName() { echo $this->getClassName(); } private function getClassName() { return 'A1'; } } $classA1 = new \App\ClassA1(); $classA1->showClassName(); We have a private method: getClassName, we use $this in the method showClassName to call the private method getClassName. After we run the script we get the result "A1" If I have ClassB1 extends ClassA1 class ClassB1 extends ClassA1 { } How can I implement what you have stated with $this and static::?
@PumpkinSpicePretzels
@PumpkinSpicePretzels Жыл бұрын
This was a great explanation. However, I'm in a strange situation where `new static` is used in a class static method that apparently has no child or parent classes 😆 so I don't understand why it's there.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Not sure what you mean? Class B extends Class A. Maybe you missed it in the video.
@sym2574
@sym2574 Жыл бұрын
👍👍👍👍👍👍👍👍👍
@ProgramWithGio
@ProgramWithGio Жыл бұрын
👍👍
@aleksandrkanygin2672
@aleksandrkanygin2672 Жыл бұрын
Can i use self for non static method calls?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You could but I'd suggest to use $this instead
@aleksandrkanygin2672
@aleksandrkanygin2672 Жыл бұрын
@@ProgramWithGio but if i want to ensure that method implementation from the current class is used and not from any child class?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@aleksandrkanygin2672 use this
@ינוןאלבז-כ1ז
@ינוןאלבז-כ1ז 2 жыл бұрын
There are many claims that PHP is a dead language, from video to video I see how it has risen to life again!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Heh, thank you 🙌. PHP isn't going anywhere regardless of what many might believe.
@abdulkaeum3863
@abdulkaeum3863 2 жыл бұрын
3rd KZbin video on Late Static Binding today. No need to go on to a 4th
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
👍
@dhiaben20
@dhiaben20 3 жыл бұрын
7:43 i didn't understand this, is there any example or article that can help understand this
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
PHP documentation is a good source: www.php.net/manual/en/language.oop5.late-static-bindings.php
@yizain1891
@yizain1891 Жыл бұрын
If none-static name set to private, classB->getName() echos A, but protected works correctly, this is strange
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Because it overrides
PHP Traits - How They Work & Drawbacks - Full PHP 8 Tutorial
31:41
Program With Gio
Рет қаралды 33 М.
У вас там какие таланты ?😂
00:19
Карина Хафизова
Рет қаралды 22 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 71 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 3 МЛН
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
Brian Will
Рет қаралды 2,1 МЛН
PHP 8 3 Released
11:03
ThePrimeTime
Рет қаралды 109 М.
PHP doesn't suck (anymore)
10:48
Aaron Francis
Рет қаралды 209 М.
PHP Enums tutorial
22:58
Gary Clarke
Рет қаралды 4,2 М.
Doctrine ORM - PHP Entities & Data Mapper Pattern - Full PHP 8 Tutorial
26:18
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 965 М.
Breaking changes in PHP 8.3!
6:07
PHP Annotated
Рет қаралды 13 М.