PHP Magic Method (Introduction), PHP Magic method Introduction _php Tutorial

Source: Internet
Author: User

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): Called when an object assigns a value to an undefined or invisible property, the parameter name is a property that needs to be assigned, and value is the values that need to be assigned to the property.

_get (String $name): Called when an object accesses an undefined or invisible property, the parameter name is the name of the property that needs to be accessed.

_isset (String $name): Called When using Isset () for an undefined or invisible property, the parameter name is the property name.

_unset (String $name): Called When using unset () for an undefined or invisible property, the parameter name is the property name.

_call (string $name, array $arguments): Called when an object calls an undefined or invisible method, the parameter name is the method name, and the parameter arguments is an array of arguments to pass to the method.

Note: The purpose of these pattern methods is to intercept operations that access non-existent object members and then respond accordingly, and these methods must be decorated with public.

http://www.bkjia.com/PHPjc/993266.html www.bkjia.com true http://www.bkjia.com/PHPjc/993266.html techarticle 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 _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.