You are here: Re: For gurus: bug in php? Recursive foreach dont work properly. « PHP Programming Language « IT news, forums, messages
Re: For gurus: bug in php? Recursive foreach dont work properly.

Posted by Vince Morgan on 04/12/07 12:17

"Toby A Inkster" <usenet200703@tobyinkster.co.uk> wrote in message
news:ivg1f4-4kp.ln1@ophelia.g5n.co.uk...
> Vince Morgan wrote:
> > Toby A Inkster wrote:
> >
> >> It's not a bug -- it's a "feature". Internally, arrays in PHP have a
> >> "pointer" (not in the C sense of the word) which points at the
"current"
> >
> > Why not in the "C sense"?
>
> A pointer in the C sense of the word is (more or less) an exact memory
> address for a piece of data.
>
> The internal pointer in a PHP array has a far more ethereal nature.
> Exactly how it works is an enigma wrapped in a riddle and shrouded by
> mystery. We don't have direct access to the pointer, but can see its
> ghostly effects in the list of functions I mentioned in my previous
> post.
Those functions had a sic "ghostly" likeness to a C++ vector and I was
wondering if in fact a vector may be used in the underlying implementation.

> It's exact implementation in the PHP source code may well be as a C
> pointer, but that doesn't (and shouldn't) matter to a person who's using
> PHP arrays. The internal implementation as might well change for each new
> version of PHP which is released -- as far as they're concerned, it
> doesn't matter, as long as each(), next() and so on keep working as they
> do.

My first problem in going from C to C++ was that I didn't "own" the pointers
of the library objects, so I appreciate what your saying here.

>
> > Something similar to an itterator in C++ ?
>
> The array is, yes.

That's what I was imagining might be below the surface.

Thank you for taking the time Toby,

Vince

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация