I came across this today and would like to know why it does this in terms of how arrays are treated in php and js.
JS
let x = [];
let i = x;
i.push('test');
console.log(x);
//prints ['test']
PHP
$x = [];
$i = $x;
array_push($i, 'test');
print_r($x);
/prints []