In PHP, array() and [] are both used to create arrays, but they are slightly different.
array() is the traditional way to create an array in PHP, and it’s a language construct. It can be used to create both indexed and associative arrays.
Example:
On the other hand, [] is a shorthand syntax for creating arrays, introduced in PHP 5.4. It’s an alternative to array() and is used to create arrays in a more concise way.
Both methods can be used interchangeably, but [] is generally preferred for its brevity and readability.