I am programming a web API client in PHP that parses CSV data into associative arrays and I want to protect my users from data-duplication when using these arrays.
My users will never be writing to these arrays (theoretically they could but it makes no sense in practice).
Now my question is... if my users pass these arrays around as arguments to methods, will PHP's copy-on-write mechanism prevent data-duplication or will any method that doesn't explicitly accept a reference to an array receive a complete copy of the array?
$a=array(...); $b=$a; $b[4000].="x";
Will the whole array be duplicated or just the one element with index 4000? – Ras