0

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?

Amarnasan
  • 14,939
  • 5
  • 33
  • 37
arun
  • 4,595
  • 5
  • 19
  • 39

1 Answers1

3

On other PC you have PHP < 5.4.

http://php.net/manual/en/language.types.array.php

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: http://php.net/supported-versions.php

Limon Monte
  • 52,539
  • 45
  • 182
  • 213