In a PHP function, I'd like to append values to an array that was passed in by reference. For example:
function foo(array &$arr) {
$arr[] = "error on this line";
$arr[] = "more";
$arr[] = "stuff";
}
The error I get when I attempt to append something to the array is
PHP Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in somefile.class.php on line xxx
I'm not sure I have the parameter defined correctly, or if this is even possible. Googling has so far not turned up any comparable examples.
EDIT: PHP Version 5.1.6.