Summary:
PHP 4 Specific.
Found Syntax difference in declaring a new array within a class?
Summary:
First of all, this seems really odd to me.
Within a PHP 4 Class, when you declare an empty array, I found the following produced a difference:
Option 1.
class myProphet()
{
var $_person;
$this->person = array();
}
Option 2.
class myProphet()
{
var $_person;
$this->person[];
}
I thought the bracket syntax for an array was just an alternative way to specify an array.
In the goal to assign three seperate arrays to one array to make one multi-dimensional array:
What I found was when assigning a set of arrays (three seperate arrays) to the empty array, Option 1 only takes that last array and not all three seperate arrays.
Option 2 takes all three seperate arrays.
Is there a 'hidden' difference in creating an array with the bracket syntax versus using the array keyword?
Thank you for reading this post.