PHP magic methods (introduction), php magic methods introduction _ PHP Tutorial

Source: Internet
Author: User
PHP magic methods (introduction), php magic methods introduction. PHP magic method (introduction), php magic method introduction publicvoid_set (string $ name, mixed $ value) publicmixed_get (string $ name) publicbool_isset (string $ name) publicvoid_uns PHP magic method (introduction), php magic method introduction

Public void _ set (string $ name, mixed $ value)

Public mixed _ get (string $ name)

Public bool _ isset (string $ name)

Public void _ unset (string $ name)

Public mixed _ call (string $ name, array $ arguments)

The functions of these methods are as follows:

_ Set (string $ name, mixed $ value): this parameter is called when an object assigns values to undefined or invisible attributes. parameter name is the attribute to be assigned, value is the value to be assigned to the attribute.

_ Get (string $ name): it is called when an object is accessed with undefined or invisible attributes. the parameter name is the name of the attribute to be accessed.

_ Isset (string $ name): isset () is called when undefined or invisible attributes are used. the parameter name is the attribute name.

_ Unset (string $ name): the parameter name is called when unset () is used for undefined or invisible attributes.

_ Call (string $ name, array $ arguments): this parameter is called when an undefined or invisible method is called. the parameter name is the method name, the arguments parameter is an array composed of parameters to be passed to the method.

Note: The role of these pattern methods is to intercept operations on non-existent object members, and then respond to them accordingly. all these methods must be modified using public.

Introduction (introduction), php magic method introduction public void _ set (string $ name, mixed $ value) public mixed _ get (string $ name) public bool _ isset (string $ name) public void _ uns...

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.