Are arrays in PHP copied as value or as reference to new variables, and when passed to functions?

1) When an array is passed as an argument to a method or function, is it passed by reference, or by value?

2) When assigning an array to a variable, is the new variable a reference to the original array, or is it new copy?
What about doing this:

$a = array(1,2,3);
$b = $a;

Is $b a reference to $a?

8 Answers
8

Leave a Comment