我一直在为一个项目创建一个 php 脚本,并一直在运行 PHP 5.4.17 的开发服务器上运行它
我需要将其移至运行 PHP 5.4.19 的生产服务器
在我的开发服务器上使用该array_map
功能时,我得到了我需要的结果,没有问题。
在我的生产服务器上,我收到解析错误:
Parse error: syntax error, unexpected '[' in /path/to/script/ on line 219
我使用的代码是:
$arr = array_map(
function($results_titles, $results_image, $results_summary, $results_dates, $results_links) {
return ['title' => $results_titles, 'image' => $results_image, 'summary' => $results_summary, 'date' => $results_dates, 'link' => $results_links];
},
$results_titles, $results_image, $results_summary, $results_dates, $results_links
);