Home > Backend Development > PHP Tutorial > Parse error: syntax error, unexpected T_FUNCTION, expecting ')'该如何解决

Parse error: syntax error, unexpected T_FUNCTION, expecting ')'该如何解决

WBOY
Release: 2016-06-13 12:17:54
Original
4495 people have browsed it

Parse error: syntax error, unexpected T_FUNCTION, expecting ')'
$c = array_map(function($chicun, $max_chicun) { return $chicun > $max_chicun ? 1 : 0; }, $chicun, $max_chicun);

报错Parse error: syntax error, unexpected T_FUNCTION, expecting ')'
请问什么原因?测试服务器上是没问题的,放在正式用的服务器上就报错
------解决思路----------------------
闭包只在 php 5.3 及以后才有,请检查你的 php 版本

其他的途径
1、定义常规函数用于回调
2、用 create_function 建立回调函数

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template