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-23 13:36:36
Original
1553 people have browsed it

$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 建立回调函数

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