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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -