Home  >  Article  >  Backend Development  >  How to use php anonymous functions

How to use php anonymous functions

WBOY
WBOYOriginal
2016-07-30 13:30:47934browse

Usage of php anonymous functions:

Considering memory factors, some functions that only need to be called once can be written in the form of anonymous functions, which can be cleared after use, as simple and efficient as post-it notes.

Characteristics of anonymous functions: 1. The function has no name and will only be used once.

2. Usually anonymous functions are assigned to a variable.

3. The calling method is also to use variables.

4. Can be deleted immediately after calling.


Result: hello!


Result: 10

Result: 13

This is my first blog post. From now on, I will write one every day to motivate myself to make progress~~

Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces the usage of PHP anonymous functions, including aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

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