Re: [PHP] Re: reference variables

2009-05-22 Thread Shawn McKenzie
kranthi wrote: > thank you for the reply. > > i had a small misunderstanding regarding variable reference...now its clear > > but.. > > the output of > > $x = 1; > $a1 = array(&$x); > var_dump($a1); > ?> > > is > array(1) { > [0]=> &int(1) > } > > while for > > $x = 1; > $a1 = array(&$x)

Re: [PHP] Re: reference variables

2009-05-22 Thread Ashley Sheridan
On Fri, 2009-05-22 at 07:44 -0500, Shawn McKenzie wrote: > kranthi wrote: > > i have this script > > > > > $x = 1; > > $y = 2; > > $a1 = array(&$x, &$y); > > $a2 = array($x, $y); > > $a2[0] = 3; > > print_r($a1); > > print_r($a2); > > ?> > > > > i am expecting > > > > Array > > ( > > [0] =>

Re: [PHP] Re: reference variables

2009-05-22 Thread kranthi
thank you for the reply. i had a small misunderstanding regarding variable reference...now its clear but.. the output of is array(1) { [0]=> &int(1) } while for it is int(1) can u tell me what & signifies here??

[PHP] Re: reference variables

2009-05-22 Thread Shawn McKenzie
kranthi wrote: > i have this script > > $x = 1; > $y = 2; > $a1 = array(&$x, &$y); > $a2 = array($x, $y); > $a2[0] = 3; > print_r($a1); > print_r($a2); > ?> > > i am expecting > > Array > ( > [0] => 3 > [1] => 2 > ) > Array > ( > [0] => 3 > [1] => 2 > ) > > > while i m getting