Simple existence of php (one of the magic methods: Fault Tolerance) _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.