Here's sample code:
<?php
$arr1 = [ 'foo' => 'bar', 'test' => '2' ];
$arr2 = [ 'foo' => 'bar', 'test' => '2' ];
$arr3 = [ $arr1, $arr2 ];
$randomArr = $arr3[mt_rand(0, count($arr3) -1)];
$randomArr['test'] = 3;
echo "$arr1: " . print_r($arr1, true);
echo "$arr2: " . print_r($arr2, true);
What I'm trying to do here is change the value of $arr1['test'] or $arr2['test'], at random, to 3. It seems $randomArr gets copied by value and not by reference. Is there a way to do a copy by reference so that I can change $arr1 or $arr2 inline?