-2

Do you know if it's better to use PHP array() or []

I know that [] is the short version of array() but I can not know the PHP recommendations ?

What is the best way to do following PHP ?

Thank you !

Corgato
  • 35
  • 8

1 Answers1

4

both are same the only difference is [ ] is supported in PHP >= 5.4:

['id' => 'id', 'name' => 'name']

This is a short syntax only and in PHP < 5.4 it won't work.

shubham715
  • 3,324
  • 1
  • 17
  • 27