After copying Laravel from one PC to another it shows a strange error from helpers.php

- 1 answer


When I copied the laravel folder from one PC to another and tried to run it, it shows the following error:

Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\accounts\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 383

The same file is working well in the source PC, but in the destination PC it is not.

I have googled it, but no help.

So I tried to make it online. Even though I have changed the name of the database in database.php file in the production server it takes the old database only.

Can anyone help me resolve this?




On other PC you have PHP < 5.4.

As of PHP 5.4 you can also use the short array syntax, which replaces array() with [].

So, most probably, on line 383 you have an array with new [] syntax.

Solution is to upgrade PHP, PHP 5.3 is not supported anymore: