|
Posted by Rami Elomaa on 04/12/07 11:41
Vince Morgan kirjoitti:
> "Toby A Inkster" <usenet200703@tobyinkster.co.uk> wrote in message
> news:gr81f4-4kp.ln1@ophelia.g5n.co.uk...
>> Tamagafk wrote:
>>
>>> Hi! Looks like there is a bug in php. If I have function which uses
>>> foreach to run trough array recursively, the lop-level foreach
>>> interupted by lover-level foreach'es. If I use simply 'for' everything
>>> is ok.
>> 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"?
Well it's not like a pointer in C. In C your basic arrays (or strings
which are just arrays of characters) are pointers to memory locations,
and the index is an offset. Since PHP works at a higher level, it
doesn't know anything about the memory, so pointers in that sense don't
exist in php. However the datastructure of an array has an internal
"pointer" but it doesn't mean the same as pointers in C.
See http://en.wikipedia.org/wiki/Pointer_%28computing%29
--
Rami.Elomaa@gmail.com
"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
[Back to original message]
|