Why do local variables in Magento have an underscore prefix?

As a continuation of an earlier question . I wonder if anyone knows why Magento templates all declare their variables under the underscore. Templates are .phtml include-ed files Mage_Core_Block_Template::fetchView(), their local variables are deleted at the end of the function and never become global.

So what is the underline point?

+3
source share
2 answers

I think he respects the ZF naming convention:

http://framework.zend.com/manual/en/coding-standard.naming-conventions.html#coding-standard.naming-conventions.variables

, , "private" "protected", . . , "public", .

+3

, , . , . , ,

, script, ,

, ,

hey, , -

"" Zend - , phtml.

+3

Source: https://habr.com/ru/post/1769876/


All Articles