Re: cvs: php4 /tests/lang 031.phpt
| From: | Rasmus Lerdorf | Date: | Sat, 23 Mar 2002 01:37:29 +0000 |
| Subject: | Re: cvs: php4 /tests/lang 031.phpt | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-10597@lists.php.net to get a copy of this message | ||
This is a bogus test. If you want to walk the same array multiple times
you need to reset() it in between. ie.
while(list(,$outerval) = each($outsidearray)) {
while(list(,$innerval) = each($insidearray)) {
print "inloop $innerval for $outerval\n";
}
reset($insidearray);
}
On Sat, 23 Mar 2002, Yasuo Ohgaki wrote:
> yohgaki Fri Mar 22 20:35:00 2002 EDT
>
> Added files:
> /php4/tests/lang 031.phpt
> Log:
> Added while(list() = each()) test
> # We may want tests/bugs ?
>
>
>
> Index: php4/tests/lang/031.phpt
> +++ php4/tests/lang/031.phpt
> --TEST--
> Nested while(list() = each()). (Bug #16227)
> --POST--
> --GET--
> --FILE--
> <?php
> // reported by php.net@alienbill.com
> $outsidearray = array("key1","key2");
> $insidearray = array("0","1");
>
> while(list(,$outerval) = each($outsidearray)){
> //$placeholder = $insidearray;
> while(list(,$innerval) = each($insidearray)){
> print "inloop $innerval for $outerval\n";
> }
> }
> ?>
> --EXPECT--
> inloop 0 for key1
> inloop 1 for key1
> inloop 0 for key2
> inloop 1 for key2
>
>
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>