Properties

Больше
1 мес. 5 дн. назад #5743 от admin
admin создал тему: Properties
The drawback of the above code is that you would...

Properties

In PHP, class member variables are also called properties. These variables are part of the class definition, and are used to represent the state of a class instance (i.e., to differentiate one instance of the class from another). In practice, you may often want to handle the reading or writing of properties in special ways. For example, you may want to always trim a string when it is being assigned to a label property. You could use the following code to achieve this task:

$object->label = trim($label);
Подробнее...