Re: [PHP4BETA] A small question
| From: | Joey | Date: | Wed, 01 Sep 1999 14:14:29 +0000 |
| Subject: | Re: [PHP4BETA] A small question | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-3966@lists.php.net to get a copy of this message | ||
I realize the $foo is not a pointer, just thought
it might be worth a shot... :) I still have problems with
my pointers in C, and thought it might be nice to learn
if PHP did it, and how...that's how I got into this whole
programming thing, ya know...
I am using CVS from about 4am Mountain Standard Time, US, this
morning.
--Joey Smith
On Wed, 1 Sep 1999, Andrey Zmievski wrote:
> Joey wrote:
> > I was trying something out, and ran into something
> > that seemed odd...
> >
> > I wanted to know what would happen if I:
> >
> > <?
> > $a = array(1,2,3,4,5,6,7,8);
> >
> > $foo = &$a[3];
> >
> > $next = $foo++;
> >
> > echo $next . "\n";
> > ?>
> >
> >
> > Hoping that maybe $a[4] would get into $next...
>
> No, $foo is not a pointer - it is a reference to $a[3] which means that both
> $foo and $a[3] get the value of 5 after $foo++, and $next is 4.
>
> > Here's what I got:
> >
> > 4
> > -: Freeing 0x001A50E8 (39 bytes), allocated in zend_hash.c on line
> > 175<br>
> > -: Freeing 0x001A4E48 (4 bytes), allocated in zend_hash.c on line 391<br>
> > -: Freeing 0x001A4DF0 (35 bytes), allocated in zend_hash.c on line
> > 380<br>
>
> I'm not getting these leaks. Are you using 4.0 beta 2?
>
> -Andrey
> * Only 19,999 lines of C++ to my next ski trip... *
>