PHP laravel array error -


how using

$myarray = [1,2]; 

instead of

$myarray = array(1,2); 

does not show error

parse error: syntax error, unexpected '[' in c:\...\laravel\public\index.php on line 3 

like in laravel-framework? thank you!

to use syntax need php >= 5.4.0:

short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];.

http://php.net/manual/en/migration54.new-features.php


btw. it's 1 of laravel requrements:

  • php >= 5.4
  • mcrypt php extension
  • openssl php extension
  • mbstring php extension
  • tokenizer php extension

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -