This would have been great if you'd explained when and why you'd use a static class over a normal one. What are the benefits? Why do they exist? When should I decide to use one? What are the drawbacks?
@thunderpeel2001 Lets say you wanted to create a class of Cats. What if you want to keep track of every cat every time you create one. All you would have to do is create a static variable and in the constructor you would increment it. As far as drawbacks go, it has the same effect (if not worse) than using global variables. Use them but don't abuse them.
In fact this isn't a static class. PHP has no static classes. It's just a regular class with static members.
suffocateforfucksake 2 weeks ago in playlist PHP OOP Tutorials
How can you use global variables in a static class?
LarsSweden100 1 month ago
@LarsSweden100 I wouldn't do this, but you could do:
public function xyz() { global $var;
}
JREAMdesign 1 month ago
@JREAMdesign Thanks it works, but how can I use a variable from a function in another function?
LarsSweden100 1 month ago
@LarsSweden100 Do this:
public static function dog() { self::$var = 'hello'; } public function cat() { echo self::$var; }
JREAMdesign 1 month ago
Instantiating!!!!!!!!!!!!
tomite2001 8 months ago in playlist PHP OOP Tutorial
This would have been great if you'd explained when and why you'd use a static class over a normal one. What are the benefits? Why do they exist? When should I decide to use one? What are the drawbacks?
thunderpeel2001 9 months ago 10
@thunderpeel2001 Lets say you wanted to create a class of Cats. What if you want to keep track of every cat every time you create one. All you would have to do is create a static variable and in the constructor you would increment it. As far as drawbacks go, it has the same effect (if not worse) than using global variables. Use them but don't abuse them.
ProgramEngineering 8 months ago
@thunderpeel2001
That is probably the only thing missing from his style of teaching.
If he adds this to all of his videos, I'd guarantee the views would be twice more.
I realized I should go and read about the purpose of each video, then come and watch.
Try this link:
forums.devshed.com/php-development-5/the-puspose-of-abstract-classes-851690.html
puaflatmates 5 months ago
@puaflatmates can't agree you more. i have to do research on my own after every tutorial to get answers of 'why ' questions.
abstract145 4 months ago
@JonnoTheBonno Thanks holmez!
JREAMdesign 10 months ago
Thank you for this!
colterbergh 10 months ago
nice tut!
FreeWebTutorialsRock 1 year ago