Join our Discord server howtocodewell.net/discord and ask coding questions in the coding-help channel
@BillClinton2284 жыл бұрын
Thank you so much for this tutorial. You have made life much easier.
@danielonibokun83515 жыл бұрын
Man you have no idea how clearly i am able to understand you compared to anyone else man. 101/100. Thank you!
@howtocodewell5 жыл бұрын
That's great to hear! Thanks
@winstonmcquoid93365 жыл бұрын
Awesome video. I've been out of the PHP loop for a few years now and this was an excellent refresher and learning experience. Thank you!
@howtocodewell5 жыл бұрын
Thanks great to hear. Enjoy
@ellbrant5 жыл бұрын
Thank you! I've been reading/researching OOP and your video put it all together for me. I especially liked that you showed the related errors, just being familiar with those will make created solid code easier. Can't wait to check out your other videos.
@howtocodewell5 жыл бұрын
I'm glad you are finding these videos helpful. I've been live coding a PHP OO applications on Twitch and archiving them here on KZbin.
@nicollado19043 жыл бұрын
Thank you for this. I am not a native English speaker yet I find this tutorial quite comprehensive. This video saves my day.
@howtocodewell3 жыл бұрын
Excellent, that’s very nice to hear
@SkyrimBeast4 жыл бұрын
Many thanks for the video Peter. It's always good for me to watch courses like this as a kind of refresher. I'm the type of developer that tends to forget stuff I haven't had to use over a period of time.
@howtocodewell4 жыл бұрын
Me too. I an always having to re trace my steps. I'm glad you liked it
@YPLabs5 жыл бұрын
Very good tutorials, thanks ! As the people below are saying your talking very clear and even in 1.5 speed it's like a breez.
@howtocodewell5 жыл бұрын
Thank you very much. Please let me know if you have any suggestions for future videos
@musiclovers84885 жыл бұрын
You are awesome dude!! I am from India and my English is not too good but how was you teaching that was totally awesome !! And the way of teaching is also too good !! Thanks a lot
@howtocodewell5 жыл бұрын
That's great to hear. Thank you :)
@musiclovers84885 жыл бұрын
You are welcome!! Can you upload video on one more topic !! How can we implement all these functions and how can we use in any real project?
@howtocodewell5 жыл бұрын
I'm working on something like that on Twitch twitch.tv/howtocodewell
@jaymillena10535 жыл бұрын
Thank you for this. This made correction to some of my false theory.
@howtocodewell5 жыл бұрын
I'm glad you found the course useful
@sale76802 жыл бұрын
Bravo best teaching ever 🙌
@howtocodewell2 жыл бұрын
Thank you
@ruans.p.53233 жыл бұрын
Good job, thank you. Subscribed.
@majedhk54605 жыл бұрын
10/10 tutorials Thank you sir *respects*
@howtocodewell5 жыл бұрын
Thank you. That's great to hear
@br31woodlands694 жыл бұрын
This is really a wonderful tutorial. Thank you much!
@howtocodewell4 жыл бұрын
You're very welcome!
@mackynyxz4 жыл бұрын
Nice tutorial! it refreshes me a lot!.
@howtocodewell4 жыл бұрын
Glad to hear that!
@shishupalsinhsodha53973 жыл бұрын
I found this very useful Tutorial
@howtocodewell3 жыл бұрын
Thank you
@ahmaddawood96915 жыл бұрын
Excellent tutorial , Thanks a lot
@howtocodewell5 жыл бұрын
You are more than welcome
@rimantasdanilevicius67545 жыл бұрын
Hi, I am did not understood one part: 1:04:41. You have 2 classes, none of classes have static method. When you want get smth Class usually we use echo $object->parameter of metchod, and this Employee:: calls static parameters or methods, is it right? I get lost here, why you use this syntax Emplyee::. is it because it is constant?
@howtocodewell5 жыл бұрын
Excellent question. Here I am accessing the constant value from outside of the class. To do this you use CLASS_NAME:: CONSTANT To do this within the class you would use self::CONSTANT In my next PHP OOP course I will explain this better. This was a great question and I will add it to the 10k subscribe AMA. Thank you
@dibbyo4563 жыл бұрын
Thank you for using CLI.
@howtocodewell3 жыл бұрын
I find that it’s the best way to do it.
@sharmashivanand4 жыл бұрын
Have been coding php for several years but it's pure joy to revisit fundamentals especially demonstrated so well. Do you also have tots on singleton, abstract, final classes?
@howtocodewell4 жыл бұрын
Not yet by they are on my list for future tutorials
@slapmyfunkybass5 жыл бұрын
Thanks for the video. Coming from a c# background I needed a refresher on php’s take on oop. Just one point, static declarations are simply shared values between different instances of the class. So you could in your constructor reference the static property, (let’s say it’s called add with default value 0), with add++. Each time an instance of that class is created, it will remember the value. You can’t do this with normal properties as they always default to their original value. Maybe php is different, but I wouldn’t have thought so.
@howtocodewell5 жыл бұрын
Yes that is a great point. I'm planning to do something similar to this when updating the invoice totals per invoice item.
@kensleylewis5 жыл бұрын
That last part was tricky, because it feels like it shoul of been parent not self, sense it was defined in the parent class, but then returned in the extended class.
@howtocodewell5 жыл бұрын
Yep that can trip me up too.
@mostafahsv33605 жыл бұрын
Thanks for this great video. I could understand every word as your style is smooth and simple. I just wanted to know what kind of code editor you use because I see it's great. Thanks in advance.
@howtocodewell5 жыл бұрын
Hi, The code editor is PHPStorm
@baref0ot4555 жыл бұрын
Is there such a thing as an association relationship in PHP? Such that a classB can contain an instance of classA as a property inside of classB? What you would call containment in other OO languages such as Java or C#. If not, how could you accomplish this is PHP? Example: class A{ // properties public string $name = ""; }// end class A class B{ // properties public $obj = new A(); }// end class B
@howtocodewell5 жыл бұрын
Hey Baref0ot yes you could use a factory pattern for this or a singleton. These are great questions. May I invite you to our Discord server where you can ask these types of questions to our growing community. You can also format code far better in Discord than KZbin comments howtocodewell.net/discord
@andreiindries11215 жыл бұрын
Awesome tutorial. Can you please tell me the Color Theme you are using? Thank you.
@howtocodewell5 жыл бұрын
I think this is Dracula. I prefer dark themes
@andreiindries11215 жыл бұрын
@@howtocodewell Thank you. Yes I am using also Dark Themes. The one you used is very easy for the eyes. I will search for it in VS Code.
@mistacodeTV5 жыл бұрын
Awesome video.
@howtocodewell5 жыл бұрын
Thank you
@ramam85825 жыл бұрын
awesome video sir
@howtocodewell5 жыл бұрын
Thank you
@yorkshireplumbing4 жыл бұрын
Why in the __set and __get methods did you use the syntax $this->$name instead of $this->name, like in the other examples?
@howtocodewell4 жыл бұрын
I'm not sure. Perhaps I slipped up
@HarisPervaiz5 жыл бұрын
Hello peter, thanks for the amazing tutorial, made my concepts clear however i have one question you called return self::$bloodType? wouldnt it be parent::$bloodType? i tested both and it outputs the same result. so whats the recommended option self or parent considering your example above
@subish20me2 жыл бұрын
self keyword is used to access the properties and methods which been declared as static whereas parent keyword is used to inherit properties/methods from parent class to child
@matthewtang21485 жыл бұрын
may I know what tool you are using? Since @5:22, it showed the explanation of the errors that is easy to understand. Appreciate for your tutor :D !
@matthewtang21485 жыл бұрын
thumb up and subscribed your channel !
@howtocodewell5 жыл бұрын
Do you mean the editor. It's PHP Storm
@matthewtang21485 жыл бұрын
@@howtocodewell thanks!
@tiffanyurigirlsg31855 жыл бұрын
May I know the code editor he is using in this video? Thank you
@howtocodewell5 жыл бұрын
This is Phpstorm
@jeannoel80414 жыл бұрын
A nice video. Anyway, I had a question on how to pass a value in the setters method so that you can access the private properties. Do you have to pass that private property (argument) in the setters method so that it can be accessed outside the scope
@howtocodewell4 жыл бұрын
You could use a public getter.
@sunnywaykar71754 жыл бұрын
Thank you sir..
@howtocodewell4 жыл бұрын
My pleasure
@syaleni25 жыл бұрын
A question that popped to my head is that, the __construct method is a public function. Nevertheless, when the Person class was extended by the Employee class, in the __construct method for Employee, the __construct method of Person class was called statically. Shouldn't that cause an error?
@howtocodewell5 жыл бұрын
Yes I can see what you mean. This how the parent class is called and it's not done statically. You've picked on a quirk of PHP 😃
@SpantikLab5 жыл бұрын
Hi Nice video helped me alot.But i have a question in getter and setter method.My question is what is the advantage of using a member of class private if it is accessible with getter and setter instead make them all public??
@Peeetfish5 жыл бұрын
Because you can control programaticly how this attribute is being manipulated. You could specify in your setter that only values greater than zero are allowed etc...if it's a public attribute you any function could access the attribute and do what ever it want with the data
@SpantikLab5 жыл бұрын
@@Peeetfish Thanks Got it
@bernardchisumo40545 жыл бұрын
Great Course
@howtocodewell5 жыл бұрын
Thanks you Bernard
@Rilex0375 жыл бұрын
Construct is magic method? So I need another method to supply mana potions to it, thanks.
@nemanjavukmirovic22625 жыл бұрын
good job sir!!!!!
@howtocodewell5 жыл бұрын
Thank you
@kinganthonyting75815 жыл бұрын
Hi! Great tutorial! May I know what code editor are you using? Thanks!
@rutera245 жыл бұрын
I think a code editor use is IDE PhpStorm
@howtocodewell5 жыл бұрын
Sorry for not getting back to you. Yes it's PHPStorm. One of my favourite coding IDE's
@howtocodewell5 жыл бұрын
Thank you for answering this. You're totally correct. It's PHPStorm 😀
@kinganthonyting75815 жыл бұрын
@@rutera24 Thank you so much!
@kinganthonyting75815 жыл бұрын
@@howtocodewell It's okay. Thank you so much!
@jhonromerofitness5 жыл бұрын
Is there anything specific you did to your terminal so it shows the PHP output as it is on your video?
@howtocodewell5 жыл бұрын
No, this is the inbuilt terminal in PHPStorm
@jhonromerofitness5 жыл бұрын
@@howtocodewell okay thanks!
@just_the_job4 жыл бұрын
Hi Peter, I was just wondering is there a follow on course on your channel that takes all this on to using interfaces, traits, abstraction and maybe the odd design pattern for a particular problem? Many thanks.
@howtocodewell4 жыл бұрын
Not yet but i will add it to my ideas list
@just_the_job4 жыл бұрын
@@howtocodewell No worries Peter, thanks for the response. Your videos are greatly appreciated, there's not many youtubers that explain oop php in the detail you have, I feel I understand your explanations really well.
@howtocodewell4 жыл бұрын
Thank you Justin
@aprattdesign4 жыл бұрын
Why are we calling self::$bloodType instead of parent::$bloodType from the Employee extended class?
@howtocodewell4 жыл бұрын
Do you have a time code for this?
@HolyErne5 жыл бұрын
Why you have to type $this -> $firstName = $firstName; I don't get this part? $firstName is equal to it self?
@nemanjavukmirovic22625 жыл бұрын
i dont understand that too, i just accepted it is this way to write...i guess thats how php know its a definition belonging to classes...but good question tho
@cristianenache87155 жыл бұрын
He doesn't actually explain a lot of what he's typing. $this->firstname refers to the public property firstName of the Person object (note there's only one dollar sign, at the beginning of this). And the $firstName on the right side of the equals sign is the parameter that the function receives, when you instantiate the class. So the constructor function receives a value for $firstName, and stores it in the public property with the same name. $this->firstName = $firstName;
@howtocodewell5 жыл бұрын
Thank you for jumping in and answering this. You are correct. I think I will need to do a refresher course or something to explain this parts in more detail.
@perianka4 жыл бұрын
@@howtocodewell please do :) we would apreciatte that
@perianka4 жыл бұрын
What's the point of makin the variables private if you're gonna write the __$SET and __$GET methods anyway?? anybody is gonna be able to change them and get them I know that you can put certain parameters in the setter to prevent the user to set it's value to something invalid, but it's still pretty public to me
@howtocodewell4 жыл бұрын
Yes this was just for demonstration purposes. Magic methods are useful when you want to apply rules to a dynamic set of properties. I don't really use them much in my day to day work.
@perianka4 жыл бұрын
@@howtocodewell oh ok thanks! by the way, I would love a more advanced tutorial on php :) like about OOP and things like that
@howtocodewell4 жыл бұрын
Hey Irina, Yeah I'm planning a PHP8 series in the future. Is there anything in particular you would like me to cover?
@Desertbynight5 жыл бұрын
Great tutorial! May I ask what is your code editor?
@howtocodewell5 жыл бұрын
Sure. For PHP I use PHPStorm and for Python I use PyCharm
@twelve90465 жыл бұрын
NetBeans
@howtocodewell5 жыл бұрын
I used to use Netbeans i loved that editor. Have you considered PHPStorm?
@twelve90465 жыл бұрын
@@howtocodewell nah, i hate subscription model of payment, i would like to pay once
@howtocodewell5 жыл бұрын
Yes I know what you mean
@JNET_Reloaded5 жыл бұрын
So confusing can i have the example code you used please il figure it out by playing?
@howtocodewell5 жыл бұрын
I don't think it's available but I will have a hunt on my old GitHub repos and check
@matthewtang21485 жыл бұрын
btw which time zone and when will you start the web chat on Friday?
@howtocodewell5 жыл бұрын
I'm not sure which we chat you mean? I live stream on Twitch Tuesday and Thursday morning's at 07:00 GMT and Sunday's at 14:30 GMT
@matthewtang21485 жыл бұрын
@@howtocodewell got it, thanks :D
@armincal98345 жыл бұрын
so i tried doing: $tom = new Person('Tom' , 'abc' , 'm'); $tom -> SayHello(); it gives me an error: too few arguments supplied for SayHello, expected 3 suplied 0. i thought the entire logic behind doing all this was to avoid having to re-write name,lastname,gender everytime? ok i found the answer myself, and im keeping this comment for anyone who might run ino the same problem in the future, when you define the SayHello function in your class, u gotta keep the argument list empty cz if u don't it will expect them even if the program doesn't really need them, what i did initially was this: SayHello($name ,$lastname , $gender) { //blah; } changed it to SayHello() { //blah; } and it works now xD
@howtocodewell5 жыл бұрын
Yeah that should be the case. The sayhello method shouldn't take any arguments. Perhaps something else is wrong. Feel free to post your code to pastebin and share the link so I can take a look
@armincal98345 жыл бұрын
@@howtocodewell thank you very much for your quick answer, it was quicker than some paid UDEMY courses xD like i said, changing the arguments did work, imma like and subscribe to support ur channel xD
@Alexandre_amds5 жыл бұрын
Parabéns
@howtocodewell5 жыл бұрын
Thank you
@ValentinDragan5 жыл бұрын
What's "oops" in you vocabulary? 32:20 38:56
@howtocodewell5 жыл бұрын
That's me making mistakes whoops 😂
@ValentinDragan5 жыл бұрын
@@howtocodewell But there were none or so it seemed.
@howtocodewell5 жыл бұрын
I think it's my English accent. When I miss type something or think that I've missed typed something I say oops out of habit. Perhaps I should do a 'oops' montage video hahaha
@ValentinDragan5 жыл бұрын
:))))
@howtocodewell5 жыл бұрын
Perhaps someone from the community could do that hahha. I'm sure I have done this a bunch of times throughout my videos
@westfield904 жыл бұрын
Just don’t know when to use the arrow sign? What does that mean?
@howtocodewell4 жыл бұрын
Do you mean this '->' as in $this->name; ? The arrow symbol here is a means to access the property or method from a class. If you join our Discord server we can help with code snippets. howtocodewell.net/discord/
@westfield904 жыл бұрын
@@howtocodewell Thank you. Yeah I see that ' -> ' all the time in PHP and Laravel code and no idea what it means. I will definitely look into joining your site. Thank you
@westfield904 жыл бұрын
@@howtocodewell BTW I have to say that I really love your clear articulate speaking and teaching style. Its very conducive to absorbing and learning this material. I would love to see you do more course and especially Laravel and React
@howtocodewell4 жыл бұрын
I have a new HTML/JS/CSS course coming out next week and on our Discord server I have asked which course I should do next. React is an option but I think it might end up being a PHP course due to the community responses
@robtee76555 жыл бұрын
Great Video. Like your accent. But Oriented != OrienTATed.
@howtocodewell5 жыл бұрын
Haha 😀😀👍
@robtee76555 жыл бұрын
@@howtocodewell Just trying to be helpful. :) The video is great!! Looked all over for something like this. Cheers and great job, again.
@yagshaiq35 жыл бұрын
is this video complete?
@howtocodewell5 жыл бұрын
It's complete in the sense that I won't be adding to it but it's not complete in the sense of OOP. I'm currently developing a new course on OOP design patterns
@skrezwan125 жыл бұрын
Your "upps" are so cute :3
@howtocodewell5 жыл бұрын
Hi Sk, I'm unsure what you mean by my 'upps' - But I will take it as a compliment 😊👍😃
@skrezwan125 жыл бұрын
@@howtocodewell "That's you making mistakes ""whoops"" " !!! :v (y) btw, carry on.
@howtocodewell5 жыл бұрын
I totally get that now! Other commenters have mentioned it too. There should be a Whoops montage video of all of my "Upps, Whoops and Opps" hahaha
@navjotsingh22515 жыл бұрын
Peter Fisher make this haha it’ll be a laugh.
@maozedong53114 жыл бұрын
@@howtocodewell right
@abhiraj34776 жыл бұрын
Sir please provide php oop project
@howtocodewell6 жыл бұрын
Do you have anything in mind?
@skrezwan125 жыл бұрын
@@howtocodewell Ticket or Hotel booking system may be the best for the learner. You can consider my idea. Thanks :)
@howtocodewell5 жыл бұрын
That's a good suggestion
@husseinmcheni32535 жыл бұрын
the best is hotel booking system
@howtocodewell5 жыл бұрын
Great suggestion
@matt68055 жыл бұрын
I don't understand the point of using the magic __get() and __set() methods on the private class variables. In the previous lesson, he says that you use the private declaration to restrict variable access to within the class, which makes total sense. But then, he goes on to use these magic methods and completely overrides the reason for making them private in the first place! He's essentially made them public. I could see using these magic methods to remove the boilerplate code for writing getters and setters, but I don't understand why you're using them to expose private variables outside of the class. Am I missing a fundamental point here?
@howtocodewell5 жыл бұрын
Hi Matt, no you're not missing anything and this is a great question. The magic methods all for access to the private properties. They are a quicker way to do it. Personally I don't like using them myself as they obscure the class definition. However they can be useful for setting defaults. Imagine you had serialised and unserialised an object and over time that objects class definition class has changed. In this case you may want to have a safety net to catch any properties that don't exist and set defaults.
@attaulmustafamustafa85725 жыл бұрын
hello sir , i want to insert php script into mysql.. how i can do..
@howtocodewell5 жыл бұрын
I'm not sure I would recommend doing that. But I guess it would be stored as a string.
@mrbale18154 жыл бұрын
You can create a new Employee with no $name , but still execute sayHello();
@martinkrivosija96854 жыл бұрын
Orientated != Oriented
@howtocodewell4 жыл бұрын
Can I ask where you spotted this mistake please?
@martinkrivosija96854 жыл бұрын
@@howtocodewell You say it at 0:09 :) Wonderful tutorial on OOP, one of the clearest explanations on youtube.
@umarhasnain73694 жыл бұрын
@@martinkrivosija9685 If it is wonderful, that why are you pointing this small mistakes? Adore this tutorial, not abuse.
@martinkrivosija96854 жыл бұрын
@@umarhasnain7369 Erm okay. Didn't know pointing something out that he can improve on next time is "abuse". You need to relax. The creator clearly read it as constructive criticism.
@2wheeledgreco2714 жыл бұрын
I got a little bit of a couch->corona
@howtocodewell4 жыл бұрын
I'm not sure what you mean....
@2wheeledgreco2714 жыл бұрын
@@howtocodewell me neither
@howtocodewell4 жыл бұрын
🤣🤣🤣
@2wheeledgreco2714 жыл бұрын
@@howtocodewell anyway great tutorial
@saltplug43954 жыл бұрын
Reeeeturn. Lol
@howtocodewell4 жыл бұрын
Pahahaha is that how I say it. I need someone to create me a blooper reel. hahaha
@saltplug43954 жыл бұрын
@@howtocodewell This video may have saved my career though, for real. Thanks. (15 year functional coder)
@howtocodewell4 жыл бұрын
@@saltplug4395 Wow really. That is great to hear. All the best! :)
@adante4075 жыл бұрын
Great tutorial. But your text is too small for iPad, mobile etc, very hard to distinguish what you are typing, your theme doesn't help, that's why VS Code is so great for tutorials. I am not criticising, it looks a great tutorial, but unfortunately the syntax is just ineligible.
@howtocodewell5 жыл бұрын
Thank you that is some great feedback. I will take this into account for future tutorials. I appreciate you bringing this to my attention
@adante4075 жыл бұрын
@@howtocodewell No probs, like I said I'm not criticising, on the contrary, its just unfortunate because it inhibits what looks a fantastic tutorial. Thanks. 👍
@howtocodewell5 жыл бұрын
Thank you
@navjotsingh22515 жыл бұрын
Peter Fisher it all looks fine and well on my iPad Pro running iOS 13. Not to sure what problems Sean is facing...