什么时候函数使用闭包在PHP实现? [英] When was function use closures implemented in PHP?

查看:111
本文介绍了什么时候函数使用闭包在PHP实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP手册中找不到解释使用

I couldn't find the section in the PHP manual that explains use

我有代码

$num = 0;
array_walk_recursive($_REQUEST, function($mValue) use (&$num){
           $num++;
        });

和我的Eclipse抱怨:

and my Eclipse complains:

Parser error "'{' expected in compound-statement.

我想这是在一些PHP版本中实现的。

So I guess this was implemented in some PHP version.

推荐答案

匿名函数/闭包和 code>语言构造在版本5.3.0中实现

Anonymous functions/closures and the use language construct were implemented in version 5.3.0

@see changelog: http://php.net/manual/en/functions.anonymous.php

@see changelog: http://php.net/manual/en/functions.anonymous.php

这篇关于什么时候函数使用闭包在PHP实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆