PHP Object Oriented Programming (OOP): Static (10/13)

preview_player
Показать описание

Official site

Twitter
Рекомендации по теме
Комментарии
Автор

tbh you really should've shown a real world example of good use for static. e.g. multiple objects keeping a count of something in a static property. static methods are not bad practice, they are just not necessary for the average user who works with frameworks

Автор

I would like to know why we do not create object to access static method or variable.

xetbyte
Автор

Would have been a great place to explain self which is what you use in place of $this inside a static method

LunchboxdadioMusic
Автор

Why static functions are bad practice? Can you give me a simple explanation? Please thank you.

japjap
Автор

Your explanation is good. But it is not clearly understandable because ur are using two or more files for explaining a topic. It will be much more helpful if you use all the code in a single file instead of using 'require.php'. While programming, using different files will be helpful but not while teaching.

gowthambalasubramanian