Home  >  Article  >  Backend Development  >  What is the way to start with __ in php

What is the way to start with __ in php

Guanhui
GuanhuiOriginal
2020-05-05 15:30:523894browse

What is the way to start with __ in php

What are the methods starting with __ in php

__construct(), __destruct(), __call(), __callStatic(), __get (), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state(), __clone() and __debugInfo() are called in PHP For Magic methods. You cannot use these method names when naming your own class methods unless you want to use their magic functionality.

Tip: PHP reserves all class methods starting with __ (two underscores) as magic methods. Therefore, when defining class methods, except for the above magic methods, it is recommended not to prefix them with __.

The above is the detailed content of What is the way to start with __ in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn