View Single Post
Old 11-17-2007, 08:03 PM   #1 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default __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
???
Tanax is offline  
Reply With Quote