Php magic methods" Name = $ name;} public function getName () {return $ this-> name;} // set the value of public function _ set ($ name, $ value) for attributes) {$ this-> $ name = $ value;} // for attributes, read the value public function _ get ($ name) {if (isset ($ this-> $ name) {return $ this-> $ name;} else {echo 'the initial value has not been set'; }}// method-specific, processing method name and parameter public function _ call ($ name, $ arguments) {var_dump ($ arguments); return $ name ;}// for direct echo class names, call the _ tostring () method public function _ tostring () {return "this is a function tostring" ;}}$ student = new person ('Zhang San '); echo $ student; // this is a function tostring $ student-> age = 'Li si'; echo $ student-> age; // Li Si echo $ student-> getAge ('32 ');"
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