PHP版本5.2.14/解析错误:语法错误,意外的T_FUNCTION,期望')' [英] PHP Version 5.2.14 / Parse error: syntax error, unexpected T_FUNCTION, expecting ')'

查看:268
本文介绍了PHP版本5.2.14/解析错误:语法错误,意外的T_FUNCTION,期望')'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些要与PHP 5.2.14一起使用的代码.它不兼容吗?我运行以下命令,

I have a certain piece of code that I'm trying to use with PHP Version 5.2.14 . Is it incompatible?? I run the following,

jailshell-3.2$ php -l /XYZ/functions.php

它给出了:

解析错误:语法错误,意外的T_FUNCTION,在/XYZ/functions.php中的第2115行中应为')' 解析/XYZ/functions.php

Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /XYZ/functions.php on line 2115 Errors parsing /XYZ/functions.php

代码是:

2114    $range = array_map(
2115                function (DatePeriod $p) use ($vt2) {
2116               $res = array();

推荐答案

您的代码使用 anonymous functions 在PHP 5.3中受支持.因此,您需要PHP 5.3才能使其正常工作.升级服务器的PHP安装.

Your code uses anonymous functions which were supported in PHP 5.3. So, you need PHP 5.3 to get it to working. Upgrade your server's PHP installation.

匿名函数(也称为闭包)允许创建没有指定名称的函数.

这篇关于PHP版本5.2.14/解析错误:语法错误,意外的T_FUNCTION,期望')'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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