13:34 - you call both the calculate_total method $book->calculate_total, and $book->read() which itself inside doin calculation, what`s the point of calling $book->calculate_total() here?
If I try echo Product::generate_id(); I get error message Fatal error: Uncaught Error: Non-static method Product::generate_id() cannot be called statically. Have things changed in PHP. I'm using version 8.
I think you have a small issue with properties and fields. properties should be built as getters,and setters. while fields were dedicated for strong data.
I hardly ever use getters and setters. They add unnecessary complexity to otherwise simple code. You can add them if you need to, I cover them in a later video. But personally, I've never needed to use them. They're more important if you're working on an open source project where the general public will be using your classes because you can change filed names without affecting functionality. It's a matter of choice and not a requirement
lol its ok, i cant make everyone happy. but learning OOP is important so find a channel with someone you can understand better and continue learning :)
13:34 - you call both the calculate_total method $book->calculate_total, and $book->read() which itself inside doin calculation, what`s the point of calling $book->calculate_total() here?
Thanks This -> really good.
you_are($most->welcome);
you forgot the dollar sign 😉
Just subscribed, you're good
Thanks for the sub! and the compliment too :)
one new subscriber
Thanks for the sub, I appreciate it😊
Thanks alot bro ♥️♥️♥️♥️♥️
most welcome
If I try echo Product::generate_id();
I get error message Fatal error: Uncaught Error: Non-static method Product::generate_id() cannot be called statically. Have things changed in PHP. I'm using version 8.
I got it. The function must be defined as static: public static
Indeed things have changed. That would have worked a few versions but back
@@QuickProgramming with php 8 not work
try this:
$obj = new Product();
echo $obj->generate_id();
define the method as static function generate_id() , i got the same error
Thank you! This has been very helpful!
I think you have a small issue with properties and fields.
properties should be built as getters,and setters.
while fields were dedicated for strong data.
I hardly ever use getters and setters. They add unnecessary complexity to otherwise simple code. You can add them if you need to, I cover them in a later video. But personally, I've never needed to use them. They're more important if you're working on an open source project where the general public will be using your classes because you can change filed names without affecting functionality. It's a matter of choice and not a requirement
YES!! thank you very much for the clarification ❤@@QuickProgramming
extremely poor explanation 😜😜😜😜
lol its ok, i cant make everyone happy. but learning OOP is important so find a channel with someone you can understand better and continue learning :)
He is totally bluffing.. am sure he envies u 💯