From 19a7b598e98c4e3ea407db21df990b6939f3b482 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 23 Mar 2009 16:54:13 +0000 Subject: [PATCH] Anonymous functions git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@277637 c90b9560-bf6c-de11-be94-00142212c4b1 --- appendices/reserved.xml | 22 ++++++++++- language/functions.xml | 37 ++++++++++++++++++- .../funchand/functions/create-function.xml | 11 +++++- 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/appendices/reserved.xml b/appendices/reserved.xml index d046e97c1a..304f931717 100755 --- a/appendices/reserved.xml +++ b/appendices/reserved.xml @@ -1,5 +1,5 @@ - + List of Reserved Words @@ -337,7 +337,7 @@ These additional predefined classes were introduced in - PHP 5.0.0 + PHP 5.0.0. @@ -358,6 +358,24 @@ + + Closure + + + The predefined final class Closure was introduced + in PHP 5.3.0. It is used for internal implementation of anonymous functions. + + + The class has a constructor forbiding the manual creation of the object + (issues E_RECOVERABLE_ERROR) and the + __invoke method with the calling magic. + + + + + Special classes diff --git a/language/functions.xml b/language/functions.xml index 8d41e79105..68aca97572 100644 --- a/language/functions.xml +++ b/language/functions.xml @@ -1,5 +1,5 @@ - + Functions @@ -603,6 +603,41 @@ $foo->$funcname(); // This calls $foo->Variable() dl. + + + Anonymous functions + + Anonymous functions allow creation of functions without specifying their + name. They are most useful in callback parameters but the usage + is not limited to that. + + + + Anonymous function example + + +]]> + + + + + Anonymous functions are internally implemented by the + Closure + class. + + + + Anonymous functions are available since PHP 5.3.0. + + + diff --git a/reference/funchand/functions/create-function.xml b/reference/funchand/functions/create-function.xml index d9a67c7e4b..19d3d21642 100644 --- a/reference/funchand/functions/create-function.xml +++ b/reference/funchand/functions/create-function.xml @@ -1,5 +1,5 @@ - + create_function @@ -229,6 +229,15 @@ Array + + &reftitle.seealso; + + + Anonymous functions + + + +