Apparently arrays in PHP are passed by value, not by reference as you would intuitively think. To illustrate, consider the following snippet of PHP code:
$b is assigned
$a, PHP actually first creates a copy of the array
$a, then assign the new array to
$b. Essentially when
$b is modified,
$a is unaffected. The output of the code above follows:
I learned this the hard way and spent too much time figuring out what was wrong with my code.
Interesting and confusing enough, class instance objects are passed by reference.