summaryrefslogtreecommitdiff
path: root/tests/lang/foreachLoopIterator.001.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lang/foreachLoopIterator.001.phpt')
-rw-r--r--tests/lang/foreachLoopIterator.001.phpt18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/lang/foreachLoopIterator.001.phpt b/tests/lang/foreachLoopIterator.001.phpt
index cba3827451..4ca5648e58 100644
--- a/tests/lang/foreachLoopIterator.001.phpt
+++ b/tests/lang/foreachLoopIterator.001.phpt
@@ -6,19 +6,19 @@ foreach with Iterator.
class MealIterator implements Iterator {
private $pos=0;
private $myContent=array("breakfast", "lunch", "dinner");
-
+
public function valid() {
global $indent;
echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
return $this->pos<3;
}
-
+
public function next() {
global $indent;
echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
return $this->myContent[$this->pos++];
}
-
+
public function rewind() {
global $indent;
echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
@@ -30,13 +30,13 @@ class MealIterator implements Iterator {
echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
return $this->myContent[$this->pos];
}
-
+
public function key() {
global $indent;
echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
return "meal " . $this->pos;
}
-
+
}
$f = new MealIterator;
@@ -44,7 +44,7 @@ var_dump($f);
echo "-----( Simple iteration: )-----\n";
foreach ($f as $k=>$v) {
- echo "$k => $v\n";
+ echo "$k => $v\n";
}
$f->rewind();
@@ -54,14 +54,14 @@ $indent = " ";
echo "\n\n\n-----( Nested iteration: )-----\n";
$count=1;
foreach ($f as $k=>$v) {
- echo "\nTop level " . $count++ . ": \n";
+ echo "\nTop level " . $count++ . ": \n";
echo "$k => $v\n";
$indent = " ";
foreach ($f as $k=>$v) {
- echo " $k => $v\n";
+ echo " $k => $v\n";
}
$indent = " ";
-
+
}
?>