PHP Closure (Closure) using the detailedFont: [Increase decrease] Type: Reprint time: 2013-05-02 I want to commentThis article describes the use of PHP closures (Closure), the need for a friend reference underUnknowingly found that PHP has been out
PHP closures and anonymous functions use the same syntax as normal functions, but closures and anonymous functions are actually objects disguised as functions (instances of the closure class). The following is to introduce the closure of PHP and
[ModernPHP] Chapter 2 Closure of new features
Closure
Closures and anonymous functions have appeared since PHP 5.3.0, which is my favorite and most commonly used PHP function. I heard these names very well (at least I thought so for the first
PHP Closure (Closure) anonymous functions in detail, Closure function of the detailed
PHP's Closure (Closure) is an anonymous function, introduced by PHP5.3.
The syntax of a closure is simple, and the key word to note is that only use,use are
This article describes how to use closure in php. For more information, see this article.
Closure, an Anonymous function, was introduced in php5.3, also known as Anonymous functions. That is, a function with no name defined. For example, the
This article is mainly to share with you the Closure class in PHP, PHP Closure class is used to represent anonymous functions of the class, anonymous functions (introduced in PHP 5.3) will produce this type of object, the Closure class summary is as
PHP 5.3 Joins the closure syntax, which is the anonymous function, which allows developers to declare inline functions and save them in variables. While this syntax is a bit weird compared to JavaScript closures, it's a good addition to the PHP
/**
* AUTHOR:SELFIMPR
* Mail: [email protected]
* blog:http://blog.csdn.net/lgg201
* The code mentioned below runs through the PHP5.3 version above.
*/
function callback ($callback) {
$callback ();
}
Output: This is a anonymous
Reprint Original Address: http://blog.csdn.net/lgg201/article/details/6127564
functioncallback($callback) {$callback();}//output: This is a anonymous function./n//Here is a direct definition of an anonymous function to pass, which is not
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.