Best php magic method tutorial and best php course, better than paid bootcamps
@chenting712 жыл бұрын
A real road map to learn PHP. Sometimes, I have to spend good time offline to grasp and have chewed understanding of your tutorial. Which is expected. Greatgreat guidance!
@ProgramWithGio2 жыл бұрын
Glad to hear, thank you 💙
@ינוןאלבז-כ1ז2 жыл бұрын
This channel is the channel with the most value on KZbin, and on the web in general, by far
@ProgramWithGio2 жыл бұрын
Thank you 💙
@bewildstudio Жыл бұрын
Super professional video tuts... so many details...even mid devs find a lot of interesting things. What a job has been done! Thank you! Definetly donate, if i find a job)
@ProgramWithGio Жыл бұрын
Thank you, glad you find videos useful 🙌
@non98312 жыл бұрын
This is how to make php great again, very good content
@ProgramWithGio2 жыл бұрын
Thank you 💙
@ינוןאלבז-כ1ז2 жыл бұрын
Exact!
@z3ko3 жыл бұрын
7 pages of notes on this video (with code examples) :D You are on another level with you knowledge and ability to clarify compared to all of the other sources.
@ProgramWithGio3 жыл бұрын
That's awesome :). Thank you so much 🙏
@sahbikardi78013 жыл бұрын
man your vidoes make everything clear thank you so much for this great content.
@ProgramWithGio3 жыл бұрын
Glad to hear that, you're welcome & thank you 🙏
@saugmaddox3493 жыл бұрын
Sir also include exception handling in this oop tutorial. Your tutorials make doubts crystal clear
@ProgramWithGio3 жыл бұрын
Definitely, exceptions lesson coming up soon
@tolebiGamingTimeАй бұрын
Good lesson
@ProgramWithGioАй бұрын
Thanks for watching
@karolzamojcin1886 Жыл бұрын
Man you keep on rockin! Starting at 00:00 I must admit that I thought that this video is going to be of no interest to me. I was wrong. __invoke & __toString are most interesting to me. Where __call & __callStatic are not short after. Wonderful, thank you Gio 🏆
@ProgramWithGio Жыл бұрын
Happy to hear, thank you
@Vitalii-m6r Жыл бұрын
There are plenty of magic methods. Thanks for this tutorial!
@ProgramWithGio Жыл бұрын
You're very welcome
@tomekmacccc1111 ай бұрын
Gamarjoba, Gio! Great tutorial! Thank you for your hard work! TM from PL :-)
@ProgramWithGio11 ай бұрын
Gamarjoba 👋. Thank you 🙏
@faramarztayyari37343 жыл бұрын
Thank you for this awesome tutorial
@ProgramWithGio3 жыл бұрын
You're welcome. Thank you!
@Zubbee2 жыл бұрын
Watched thrice already. Each time things were clearer but I still didn't get some magic methods (__call and __callStatic). But you did say not to worry if we don't get it as of now. Thanks alot Gio
@ProgramWithGio2 жыл бұрын
You'll see more examples of call & call static in third section and will understand it more 👍
@CarlosOrtiz-sz2pp2 жыл бұрын
Magic methods are very interesting lesson. thank you
@ProgramWithGio2 жыл бұрын
Glad you like them. Thank you
@karam01012 жыл бұрын
Another great tutorial. Thank you for sharing all these concepts
@ProgramWithGio2 жыл бұрын
Thank you 🙌
@Armando-px8hi Жыл бұрын
The best of the best!)
@ProgramWithGio Жыл бұрын
Thank you
@josephnduati1214 Жыл бұрын
Thanks a Ton!
@ProgramWithGio Жыл бұрын
You're welcome
@ilya_123__ Жыл бұрын
thank you!
@ProgramWithGio Жыл бұрын
You're welcome!
@memack1012 жыл бұрын
Thank you.
@ProgramWithGio2 жыл бұрын
You're welcome!
@baptistedara80262 жыл бұрын
you are amazing dude thank you
@ProgramWithGio2 жыл бұрын
No, you're amazing, thank you 🙌
@МаксимСлободянюк-н9о3 жыл бұрын
Thank you SO MUCH!!!
@ProgramWithGio3 жыл бұрын
You're welcome!
@shaikhalamin232 жыл бұрын
Thanks for your great tutorial. I request to you that can you please make your playback little slow.? sometimes I really get over whelmed by your speaking speed.
@ProgramWithGio2 жыл бұрын
Thanks for the feedback. I know about that and improved on it in later videos. You can also adjust the speed on KZbin and slow it down for those that are too fast
@AbdouAbdou-hu9un Жыл бұрын
thank you @Gio, in 14:51 you said you needed class with one method than why didn't you just declare a function instead ?
@ProgramWithGio Жыл бұрын
You could, it's just if you have a class with just a single method you might like the invokable option better, it comes down to preference, nothing wrong with having a single method in a class
@vkmishra.singer2 жыл бұрын
Great!! I request you to please create the course for laravel and explain whatever OOPS concept is used there.
@ProgramWithGio2 жыл бұрын
Thank you. I'll have more laravel content once I finish this series
@vkmishra.singer2 жыл бұрын
@@ProgramWithGio Thanks. I will be waiting for new awesome laravel series.
@abduabdu7404Ай бұрын
Hello Gio, in the examples of using the call() method why didn't you use the splat operator and instead used call_user_func_array(), is there any advanced reason for that, like a better performance from call_user_func_array()?
@ProgramWithGioАй бұрын
Probably an old habit. Yes the splat operator would work as well & is actually probably faster than using the call_user_func_array
@abduabdu740429 күн бұрын
@@ProgramWithGio Thank you for your response, its not only the course that is great but also you as a person for not being arrogant and helping others learn what is best to learn and updating the course two years later❤
@lxbdr Жыл бұрын
Thanks for the great series! Do I get it right that the __invoke pattern can be used to make a function available to a class via DI so it is a explicit dependency instead of relying on a regular function to be present?
@ProgramWithGio Жыл бұрын
Invoke just makes class be called as a function. Makes something like this possible: (new A())()
@kvanca2330 Жыл бұрын
Amazing series thank you. After years with php still something to learn. Can you deep dive to laravel to show those magic methods in action?
@ProgramWithGio Жыл бұрын
Thank you 🙌. I'll be doing more Laravel content in 2023
@kvanca2330 Жыл бұрын
@@ProgramWithGio Glad to here that. Wish you best of luck
@ProgramWithGio Жыл бұрын
@@kvanca2330 thank you 🙌
@bakre_dev8728 Жыл бұрын
Thanx 🎉
@ProgramWithGio Жыл бұрын
No problem
@DAG_r82 жыл бұрын
Hi Gio, thank you for this , What is the advantage of using __invoke vs calling a function from the constructor ?
@ProgramWithGio2 жыл бұрын
It's ideal if you don't execute any methods in constructor because then when you inject that class as a dependency anywhere else if you use autowiring DI it will be executing it every time and can affect performance depending on what the method is or worse perform some updates again depending on what that method does.
@SaiyanJin85 Жыл бұрын
Thanks for the great video! I think using the magic methods should be done when someone builds a framework or something like that. I see no reason to use the_get or _set_ for example on a project that has business logic, imagine unsetting or setting properties on the fly...
@ProgramWithGio Жыл бұрын
It depends, it can be useful in non framework/library code as well. Although, I agree with having less magic in userland
@SaiyanJin85 Жыл бұрын
@@ProgramWithGio Thanks for the reply and your videos! Great job!
@massimoramaj3233 Жыл бұрын
Hey Gio ,what's the difference between accessing properties as $this->$property and as $this->property , cuz both ways work!
@ProgramWithGio Жыл бұрын
$this->property accesses the value of the property defined in the class, $this->$property access the value of a property whose name comes from the value of variable $property. Its variable variables, we covered that in first section.
@Em1lka_11 ай бұрын
Hi Gio, could you recommend any plugins for php storm? Something for php/laravel
@ProgramWithGio11 ай бұрын
I don't really use any plugins, only when I have specific needs but for the most part phpstorm is enough
@saravanasai23912 жыл бұрын
Sir really i have watching this video 10 time ...i cant remember this lots of information...how can we practice to get a better more understanding practicaly
@ProgramWithGio2 жыл бұрын
The best thing to do is try it out on a project. Build a todo list or even refactor the exercise from the first section and try to apply magic methods to it.
@NedumEze2 жыл бұрын
Sorry, Gio, why do we have "return $this->$name"? I thought it should be the conventional "$this->name". Or have I missed something?
@ProgramWithGio2 жыл бұрын
It's called variable variables. We covered that in the first section. $this->name would return the value of name property where $this->$name returns the value of the property of whatever the $name evaluates to.
@NedumEze2 жыл бұрын
@@ProgramWithGio Ah! Thanks. I didn't read it that way.
@keremardicli4013 Жыл бұрын
Magic methods are indeed magic. It is hard to wrap my head around.
@ProgramWithGio Жыл бұрын
Heh, yea it can be tricky at times
@chenting712 жыл бұрын
By the way, I understand those magic methods as "Event Trigger" provided by PHP, when operating on $object :D
@ProgramWithGio2 жыл бұрын
👍
@AJ-Pixelyze3 жыл бұрын
Hey, I wonder if you could make a video of how to use PHP with javascript. I know how to use JS but when it comes to PHP and JS working together with HTML, I have no clue how to connect them when it comes to DOM to add some JS
@ProgramWithGio3 жыл бұрын
The project that we'll work on at the end of the series will have some JavaScript so that might be helpful.
@أحمدكلش-ض3ع Жыл бұрын
i hop you start laravel course before i finish this course
@ProgramWithGio Жыл бұрын
I hope too :)
@dawid_dahl3 жыл бұрын
Is there any reason why one would do a single responsibility class with the __invoke magic method, when one could just maybe write a simple function? 🤔
@ProgramWithGio3 жыл бұрын
Mostly it's preference. Usually used got single action controllers or when you have action classes with single methods. You can also pass an object of class as callable/closure when it is invokable, though I haven't tried this in awhile so you would have to test it
@hancysp2 жыл бұрын
volim
@ProgramWithGio Жыл бұрын
💙💙
@sergeisurin2963 Жыл бұрын
👍🙏
@ProgramWithGio Жыл бұрын
🙏
@FGj-xj7rd2 жыл бұрын
There is nothing magical about these methods 👎
@ProgramWithGio2 жыл бұрын
That's what it's called 🙂
@FGj-xj7rd2 жыл бұрын
@@ProgramWithGio I know 🤷🏻♂️
@aiphan31262 жыл бұрын
public function __call(string $name, array $arguments) { if (method_exists($this, $name)){ $this->$name(...$arguments); # instead of call_user_func_array([$this, $name], $arguments); } } Hi sir, I found out this, it also worked. Are they different ?
@ProgramWithGio2 жыл бұрын
That would work as well, in this example they are pretty much the same, might be some differences in terms of performance but I have not benchmarked it.
@aerohcssАй бұрын
Hey, Gio, thanks for your hard work, I love course very much so far! Just wanted to add that code on kzbin.info/www/bejne/pHTbn62gbZijpbM will cause the error if you comment out the line $invoice->amount = 35; The Error is "Typed property app\Invoice::$data must not be accessed before initialization". I guess the solution is just setting to $data property default value []
@aerohcssАй бұрын
I just watched video further, so nevermind 😀
@ProgramWithGioАй бұрын
Hey, thank you. Yea the error would make sense if you comment out that part :)