PHP/Class/ set

Материал из Web эксперт
Перейти к: навигация, поиск

__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";
?>