diff --git a/language/types/callable.xml b/language/types/callable.xml index 40986f124f..cafbdb8f76 100644 --- a/language/types/callable.xml +++ b/language/types/callable.xml @@ -44,10 +44,9 @@ - Apart from common user-defined function, create_function - can also be used to create an anonymous callback function. As of PHP 5.3.0 - it is possible to also pass a - closure to a callback parameter. + Apart from common user-defined function, + anonymous functions can also be + passed to a callback parameter. diff --git a/reference/array/functions/array-map.xml b/reference/array/functions/array-map.xml index ab2793d57b..6f2db2c82a 100644 --- a/reference/array/functions/array-map.xml +++ b/reference/array/functions/array-map.xml @@ -346,7 +346,6 @@ array(1) { array_filter array_reduce array_walk - create_function &seealso.callback; diff --git a/reference/array/functions/array-walk.xml b/reference/array/functions/array-walk.xml index 68c192112d..66d34d82db 100644 --- a/reference/array/functions/array-walk.xml +++ b/reference/array/functions/array-walk.xml @@ -152,7 +152,6 @@ c. fruit: apple array_walk_recursive iterator_apply - create_function list each call_user_func_array diff --git a/reference/funchand/functions/create-function.xml b/reference/funchand/functions/create-function.xml index 93e5d65f46..e0e674bf12 100644 --- a/reference/funchand/functions/create-function.xml +++ b/reference/funchand/functions/create-function.xml @@ -17,6 +17,17 @@ Creates an anonymous function from the parameters passed, and returns a unique name for it. + + + This function internally performs an eval and as such has the + same security issues as eval. Additionally it has bad performance + and memory usage characteristics. + + + If you are using PHP 5.3.0 or newer a native + anonymous function should be used instead. + + &reftitle.parameters; diff --git a/reference/mbstring/functions/mb-ereg-replace-callback.xml b/reference/mbstring/functions/mb-ereg-replace-callback.xml index 6d24ed131d..f455869273 100644 --- a/reference/mbstring/functions/mb-ereg-replace-callback.xml +++ b/reference/mbstring/functions/mb-ereg-replace-callback.xml @@ -56,9 +56,8 @@ You'll often need the callback function for a mb_ereg_replace_callback in just one place. In this case you can use an - anonymous function (since - PHP 5.3.0) or create_function to - declare an anonymous function as callback within the call to + anonymous function to + declare the callback within the call to mb_ereg_replace_callback. By doing it this way you have all information for the call in one place and do not clutter the function namespace with a callback function's name @@ -175,7 +174,6 @@ echo mb_ereg_replace_callback( mb_regex_encoding mb_ereg_replace - create_function Anonymous functions &seealso.callback; diff --git a/reference/outcontrol/functions/ob-list-handlers.xml b/reference/outcontrol/functions/ob-list-handlers.xml index 4772206185..fd8bded77a 100644 --- a/reference/outcontrol/functions/ob-list-handlers.xml +++ b/reference/outcontrol/functions/ob-list-handlers.xml @@ -45,7 +45,7 @@ print_r(ob_list_handlers()); ob_end_flush(); // anonymous functions -ob_start(create_function('$string', 'return $string;')); +ob_start(function($string) { return $string; }); print_r(ob_list_handlers()); ob_end_flush(); ?> @@ -66,7 +66,7 @@ Array Array ( - [0] => default output handler + [0] => Closure::__invoke ) ]]> diff --git a/reference/pcre/functions/preg-replace-callback.xml b/reference/pcre/functions/preg-replace-callback.xml index 7abc47d940..161a0266dd 100644 --- a/reference/pcre/functions/preg-replace-callback.xml +++ b/reference/pcre/functions/preg-replace-callback.xml @@ -55,9 +55,8 @@ You'll often need the callback function for a preg_replace_callback in just one place. In this case you can use an - anonymous function (since - PHP 5.3.0) or create_function to - declare an anonymous function as callback within the call to + anonymous function to + declare the callback within the call to preg_replace_callback. By doing it this way you have all information for the call in one place and do not clutter the function namespace with a callback function's name @@ -235,7 +234,6 @@ echo $output; PCRE Patterns preg_replace preg_last_error - create_function Anonymous functions &seealso.callback;