Re: [PRES] cvs: pres2 / show.php

From: Date: Thu, 07 Nov 2002 07:48:46 +0000
Subject: Re: [PRES] cvs: pres2 / show.php
References: 1  Groups: php.pres 
Request: Send a blank email to pres+get-501@lists.php.net to get a copy of this message
Rasmus Lerdorf wrote:
OK, I'll make the changes accordingly. BTW, the array pointer seems to be moved (without the reset(), the each() that follows doesn't do anything, however, the documentation says that the foreach() is supposed to operate on a copy of the array and *not* modify the array pointer? Is the documentation out of date, or is this a bug?
No bug, that is the way it is suppposed to work. foreach() uses the array pointer to iterate over the array and provides a copy of the data in the key,value pairs.
OK, I am I misreading the docs, here or should I file a documentation bug? http://www.php.net/manual/en/control-structures.foreach.php '*Note: * Also note that foreach operates on a copy of the specified array, not the array itself, therefore /the array pointer is not modified as with the *each()* <http://www.php.net/manual/en/function.each.php> construct/ and changes to the array element returned are not reflected in the original array.' Also, the code I checked in uses the is_a() function, which apparently is 4.2+. If this is an issue (is there a minimum platform that's being targeted?) then I can modify the code to use the get_class() function. -- .leonard http://randomfoo.net/

« previous php.pres (#501) next »