function - PHP: syntax error, unexpected '[' when using array_map -
I am creating a php script for a project and running on my development server which is running PHP 5.4.
I have to transfer it to my production server which is running PHP 5.4.19
Get me when using the array_map
function on my development server The result of which I have no problem.
I get a parse error on my production server:
Parse error: syntax error, unexpected '[' in / path / to / script / on line 21 9 < / Code>
My code was used:
$ arr = array_map (function ($ results_titles, $ results_image, $ results_summary, $ results_dates, $ Results_links) { Return ['title' = & gt; $ results_titles, 'image' = & gt; $ results_image, 'summary' = & gt; $ result_company, 'date' = & gt; $ results_dates, 'link' = & gt; $ Results_links];}, $ results_text, $ results_image, $ results_summary, $ results_dates, $ results_links);
The new array syntax comes with PHP 5.4.
Then make sure that your PHP version> = PHP 5.4
Note: In your server, the different versions of the php are: Clear and Web server (eg: Apache) Can run.
Comments
Post a Comment