PHP array reference issue -
$a=array(1 => "a"); $b=&$a[1]; $c=$a; $c[1]="c"; echo $a[1];
output : c (but expecting output )
apparently, array not referenced '=' sign.
$c=$a; < should make copy of $a , assign $c . why reference take place here?
moreover, if remove second line ( $b=&$a[1]; ), or replace ($b=&$a;), behaves expected.
any explanation why happens?
Comments
Post a Comment