NYCPHP Meetup

NYPHP.org

[nycphp-talk] var_dump says "&object(myobj)(10)"

Chris Bielanski Cbielanski at inta.org
Tue Mar 9 16:42:01 EST 2004


I'll toss in a guess - but it's complete speculation:

With register_globals turned on, the values all get put in a single massive
symbol table (or heap, or whatever) and all values are references. With it
turned off, the symbol table can be managed more effectively, and you get
values in place of those references.

Of course, I could be way off - I can envision what's going on but my lack
of scholastic training in the subject serves to limit my vocabulary.

> -----Original Message-----
> From: Allen Shaw [mailto:ashaw at iifwp.org]
> Sent: Tuesday, March 09, 2004 3:15 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] var_dump says "&object(myobj)(10)"
> 
> 
> Thanks.  Actually, I thought it was something like that, but 
> without knowing
> more, do you have any guess as to why changing 
> register_globals would affect
> whether it gets added as a reference or not?
> 
> ----- Original Message ----- 
> From: "Daniel Convissor" <danielc at analysisandsolutions.com>
> To: "NYPHP Talk" <talk at lists.nyphp.org>
> Sent: Tuesday, March 09, 2004 2:52 PM
> Subject: Re: [nycphp-talk] var_dump says "&object(myobj)(10)"
> 
> 
> > On Tue, Mar 09, 2004 at 02:40:22PM -0500, Allen Shaw wrote:
> > >
> > > With register_globals=off, the object $myobj is listed with an
> ampersand,
> > > like so:
> >
> > They both contained the same output.
> >
> >
> > > Can anyone tell me what that ampersand is?
> >
> > Ampersands refer to references.  Example:
> >
> > <?php
> > $x['a'] = 'one';
> > $x['b'] =& $x['a'];
> > $x['c'] = 'three';
> >
> > var_dump($x);
> >
> > $x['a'] = 'two';
> >
> > var_dump($x);
> > ?>
> >
> > Output:
> >
> > array(3) {
> >   ["a"]=>
> >   &string(3) "one"
> >   ["b"]=>
> >   &string(3) "one"
> >   ["c"]=>
> >   string(5) "three"
> > }
> > array(3) {
> >   ["a"]=>
> >   &string(3) "two"
> >   ["b"]=>
> >   &string(3) "two"
> >   ["c"]=>
> >   string(5) "three"
> > }
> >
> > Notice how I changed the value of b by changing the value of a.
> >
> > --Dan
> >
> > -- 
> >  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
> >             data intensive web and database programming
> >                 http://www.AnalysisAndSolutions.com/
> >  4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 



More information about the talk mailing list