All pastes #255298 Raw Edit

Someone

public php v1 · immutable
#255298 ·published 2006-11-22 20:46 UTC
rendered paste body
class BaseObject{    public function __construct($args=NULL)    {        if($args) {            foreach($args as $key=>$value) {                is_null($this->$key);   # cause E_NOTICE if member not defined                $this->$key=$value;            }        }    }    public function __set($name,$value)    {        if($this->$name) {            $this->$name= $value;        }        else {            trigger_error("setting undefined member '$name'  to '$value'  in Class '" .@get_class($this). "' ",E_USER_WARNING);            $this->$name= $value;        }    }    #--- get --------------------------------------    public function __get($nm)    {        if (isset($this->$nm)) {           return $r;        }        else {            trigger_error("reading undefined member '$nm'  in '" .@get_class($this). "' ", E_USER_WARNING);        }    }}