11-17-2007, 08:03 PM
|
#1 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
__get and __set ??
Hi.
Can someone please explain how they work?
PHP Code:
private $tables = array();
public function __set($field, $value) {
$this->tables[$field] = $value;
}
public function __get($field) {
return $this->tables[$field];
}
PHP Code:
$object->user_name = 'user_name';
$object->user_reg_date = 'register_date';
That would set tables['user_name'] to user_name, and tables['user_reg_date'] to register_date.
However, how do I GET them??
PHP Code:
echo $object->user_reg_date;
???
|
|
|
|