Why does the Zend scheme emphasize the underscore here?

What is the point of having $ _comment instead of $ comment?

class Default_Model_Guestbook
{
    protected $_comment;
    protected $_created;
    protected $_email;
    protected $_id;
    protected $_mapper;
+2
source share
2 answers

The prefix of protected and private class variables is a general convention in PHP. This simplifies the distinction between public and protected or private.

+12
source

Quoted from the Zend Framework Coding Agreement

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

Code Convention, , , . , , . ZF .

PHP-, ZF, PEAR PHP Coding Standard. , ( ).

+11
source

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


All Articles