The simple existence of php (one of the magic methods: fault tolerance ). Php simple existence (one of the magic methods: Fault Tolerance) name $ name; $ this-age $ age;} obtain the magic method # @ paramstring $ namepublicfunction _ get ($ param) {return $ this-$ p simple php (one of the magic methods: fault tolerance)
Name = $ name; $ this-> age = $ age;} // Obtain the magic method # @ param string $ namepublic function _ get ($ param) {// return $ this-> $ param; # attributes that can be accessed $ allow = array ('age'); if (in_array ($ param, $ allow )) {return $ this-> $ param; }}// _ set () sets the magic method # @ param string $ name # param string $ valpublic function _ set ($ name, $ val) {$ allow = array ('age', 'Money'); if (in_array ($ name, $ allow )) {$ this-> $ name = $ val;} // _ isset () judge public function _ isset ($ name) {return isset ($ this-> $ name);} // _ unset destroy data public function _ unset ($ name) {// Create an unset list $ allow = array ('tail'); if (in_array ($ name, $ allow) {echo 'unset running '; unset ($ this-> $ name) ;}}// instantiate $ p = new Person ('zp', 21); $ p-> age = 200; echo $ p-> money = 200000000; $ p-> tail = "a"; var_dump (isset ($ p-> name )); var_dump (isset ($ p-> age); var_dump (isset ($ money); // var_dump (empty ($ tail )); unset ($ p-> tail); // var_dump ($ tail );
The simple existence of the http://www.bkjia.com/PHPjc/969599.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/969599.htmlTechArticlephp (one of the magic methods: Fault Tolerance) name = $ name; $ this-> age = $ age ;} // Obtain the magic method # @ param string $ namepublic function _ get ($ param) {// return $ this-> $ p...