cvs: php4 /tests/lang 031.phpt
| From: | Preston L. Bannister | Date: | Thu, 16 May 2002 21:57:24 +0000 |
| Subject: | cvs: php4 /tests/lang 031.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-11964@lists.php.net to get a copy of this message | ||
pbannister Thu May 16 17:57:24 2002 EDT
Modified files:
/php4/tests/lang 031.phpt
Log:
More detailed/explanatory output.
Index: php4/tests/lang/031.phpt
diff -u php4/tests/lang/031.phpt:1.5 php4/tests/lang/031.phpt:1.6
--- php4/tests/lang/031.phpt:1.5 Fri Mar 29 12:12:11 2002
+++ php4/tests/lang/031.phpt Thu May 16 17:57:24 2002
@@ -5,16 +5,66 @@
--FILE--
<?php
// reported by php.net@alienbill.com
-$outsidearray = array("key1","key2");
-$insidearray = array("0","1");
+$arrayOuter = array("key1","key2");
+$arrayInner = array("0","1");
-while(list(,$outerval) = each($outsidearray)){
- $placeholder = $insidearray;
- while(list(,$innerval) = each($insidearray)){
- print "inloop $innerval for $outerval\n";
+print "Correct - with inner loop reset.\n";
+
+while(list(,$o) = each($arrayOuter)){
+ reset($arrayInner);
+ while(list(,$i) = each($arrayInner)){
+ print "inloop $i for $o\n";
+ }
+}
+reset($arrayOuter);
+reset($arrayInner);
+
+print "What happens without inner loop reset.\n";
+
+while(list(,$o) = each($arrayOuter)){
+ while(list(,$i) = each($arrayInner)){
+ print "inloop $i for $o\n";
}
}
+reset($arrayOuter);
+reset($arrayInner);
+
+print "What happens without inner loop reset but copy.\n";
+
+while(list(,$o) = each($arrayOuter)){
+ $placeholder = $arrayInner;
+ while(list(,$i) = each($arrayInner)){
+ print "inloop $i for $o\n";
+ }
+}
+reset($arrayOuter);
+reset($arrayInner);
+
+print "What happens with inner loop reset over copy.\n";
+
+while(list(,$o) = each($arrayOuter)){
+ $placeholder = $arrayInner;
+ while(list(,$i) = each($placeholder)){
+ print "inloop $i for $o\n";
+ }
+}
+reset($arrayOuter);
+reset($arrayInner);
?>
--EXPECT--
+Correct - with inner loop reset.
+inloop 0 for key1
+inloop 1 for key1
+inloop 0 for key2
+inloop 1 for key2
+What happens without inner loop reset.
+inloop 0 for key1
+inloop 1 for key1
+What happens without inner loop reset but copy.
+inloop 0 for key1
+inloop 1 for key1
+What happens with inner loop reset over copy.
inloop 0 for key1
inloop 1 for key1
+inloop 0 for key2
+inloop 1 for key2