Just see the code ~
<?php
$foo = [ 'foo' => 1 ];
$nothing = &$foo['foo'];
$bar = $foo;
$bar['foo'] = '2';
echo $foo['foo'];
Every version of php get result 2
but why ?
Isn't bar
a totally different variable besides foo
?
Just see the code ~
<?php
$foo = [ 'foo' => 1 ];
$nothing = &$foo['foo'];
$bar = $foo;
$bar['foo'] = '2';
echo $foo['foo'];
Every version of php get result 2
but why ?
Isn't bar
a totally different variable besides foo
?