Short array syntax []
was introduced a while back when PHP 5.4 was released. Basically it is ability to define arrays using []
instead of array()
.
Using any of the above will result the same output.
WordPress prefer array()
instead of short array syntax , because it can run on PHP 5.2 , and []
was not introduced back then. Using short array syntax can breaks some sites running on wordpress.
Happy Coding 😍