In my PHP(5.4.19) app, I assigned string values to two different arrays. One array is scoped to the method, and the other array is a class property:
class AnyClass{
public $foo = array();
public function anyMethod(){
$bar = array();
$bar[] = 'anyTextA';
$this->foo[] = 'anyTextB';
return array( $bar, $this->foo );
}
}
Here is what anyMethod() returns:
Array
(
[0] => Array
(
[0] => anyTextA
)
[1] => Array
(
[0] => anyTextB
[1] => anyTextB
)
)
Why are two elements appearing in the second array when only one assignment has taken place?