10

array(1, 2) or [1, 2]?

Comments
  • 1
  • 1
    Definitely [1, 2] :)
  • 1
    array (1,2) it's easier to find and identify an array when you can look and search for the word array
  • 2
    I'd say [1,2] for me.
  • 2
    i prefer the shorthand syntax.
  • 0
    [1,2] for sure. It's not technically shorthand, just an upgrade in the syntax since let's be fair, it's not that much shorter than array(1,2) 😂

    I would advice though not to mix in the same file since it can get messy and confusing for future maintainers.
  • 0
    It's literally called shorthand syntax, check the manual :)
  • 1
    Had a problem with [1,2] format the other day the clients hosting provider said my code was unusable and of poor quality, actual problem was PHP version 5.2! I told them that there service is crap and out dated and that I wouldn't be changing my code, client now hosts via me :D
Add Comment