__set( ) method is called whenever an undefined property is set in your scripts : __set « Class « PHP






__set( ) method is called whenever an undefined property is set in your scripts

 
<?
    class MyTable {
            public $Name;

            public function _ _construct($Name) {
                    $this->Name = $Name;
            }

            public function _ _set($var, $val) {
                    mysql_query("UPDATE {$this->Name} SET $var = '$val';");
            }
    }

    $systemvars = new MyTable("systemvars");
    $systemvars->AdminEmail = 't@s.net';
?>
  
  








Related examples in the same category