In PHP I have seen the following types of coding:
my_array[] = "fish";
my_array[] = "book";
my_array[] = "chair";
Other times I have seen this done:
my_array = array();
my_array[] = "fish";
my_array[] = "book";
my_array[] = "chair";
What would be the purpose of "defining" an array in PHP with array() like above? Is it a good practice, if so why?
my_arrayis an array (PHP is intelligent to detect its type), You are pushing elements to that array.my_array = array();?