<?php
class IncrementIterator implements iterator {
protected $start;
protected $end;
protected $current;
public function __construct($start, $end) {
$this->start = $start;
$this->end = $end;
}
public function rewind() {
$this->current = $this->start;
}
public function valid() {
return $this->current <= $this->end;
}
public function key() {
return $this->current;
}
public function current() {
return $this->current;
}
public function next() {
$this->current++;
}
}
$aIterator = new IncrementIterator(0, 26);
$bIterator = new IncrementIterator(0, 26);
$cIterator = new IncrementIterator(0, 26);
$dIterator = new IncrementIterator(0, 26);
$multipleIterator = new MultipleIterator();
$multipleIterator->attachIterator($aIterator);
$multipleIterator->attachIterator($bIterator);
$multipleIterator->attachIterator($cIterator);
$multipleIterator->attachIterator($dIterator);
foreach ($multipleIterator as $current) {
var_dump($current);
}
- Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- Deprecated: Return type of IncrementIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 24
Deprecated: Return type of IncrementIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 28
Deprecated: Return type of IncrementIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 20
Deprecated: Return type of IncrementIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 16
Deprecated: Return type of IncrementIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 12
array(4) {
[0]=>
int(0)
[1]=>
int(0)
[2]=>
int(0)
[3]=>
int(0)
}
array(4) {
[0]=>
int(1)
[1]=>
int(1)
[2]=>
int(1)
[3]=>
int(1)
}
array(4) {
[0]=>
int(2)
[1]=>
int(2)
[2]=>
int(2)
[3]=>
int(2)
}
array(4) {
[0]=>
int(3)
[1]=>
int(3)
[2]=>
int(3)
[3]=>
int(3)
}
array(4) {
[0]=>
int(4)
[1]=>
int(4)
[2]=>
int(4)
[3]=>
int(4)
}
array(4) {
[0]=>
int(5)
[1]=>
int(5)
[2]=>
int(5)
[3]=>
int(5)
}
array(4) {
[0]=>
int(6)
[1]=>
int(6)
[2]=>
int(6)
[3]=>
int(6)
}
array(4) {
[0]=>
int(7)
[1]=>
int(7)
[2]=>
int(7)
[3]=>
int(7)
}
array(4) {
[0]=>
int(8)
[1]=>
int(8)
[2]=>
int(8)
[3]=>
int(8)
}
array(4) {
[0]=>
int(9)
[1]=>
int(9)
[2]=>
int(9)
[3]=>
int(9)
}
array(4) {
[0]=>
int(10)
[1]=>
int(10)
[2]=>
int(10)
[3]=>
int(10)
}
array(4) {
[0]=>
int(11)
[1]=>
int(11)
[2]=>
int(11)
[3]=>
int(11)
}
array(4) {
[0]=>
int(12)
[1]=>
int(12)
[2]=>
int(12)
[3]=>
int(12)
}
array(4) {
[0]=>
int(13)
[1]=>
int(13)
[2]=>
int(13)
[3]=>
int(13)
}
array(4) {
[0]=>
int(14)
[1]=>
int(14)
[2]=>
int(14)
[3]=>
int(14)
}
array(4) {
[0]=>
int(15)
[1]=>
int(15)
[2]=>
int(15)
[3]=>
int(15)
}
array(4) {
[0]=>
int(16)
[1]=>
int(16)
[2]=>
int(16)
[3]=>
int(16)
}
array(4) {
[0]=>
int(17)
[1]=>
int(17)
[2]=>
int(17)
[3]=>
int(17)
}
array(4) {
[0]=>
int(18)
[1]=>
int(18)
[2]=>
int(18)
[3]=>
int(18)
}
array(4) {
[0]=>
int(19)
[1]=>
int(19)
[2]=>
int(19)
[3]=>
int(19)
}
array(4) {
[0]=>
int(20)
[1]=>
int(20)
[2]=>
int(20)
[3]=>
int(20)
}
array(4) {
[0]=>
int(21)
[1]=>
int(21)
[2]=>
int(21)
[3]=>
int(21)
}
array(4) {
[0]=>
int(22)
[1]=>
int(22)
[2]=>
int(22)
[3]=>
int(22)
}
array(4) {
[0]=>
int(23)
[1]=>
int(23)
[2]=>
int(23)
[3]=>
int(23)
}
array(4) {
[0]=>
int(24)
[1]=>
int(24)
[2]=>
int(24)
[3]=>
int(24)
}
array(4) {
[0]=>
int(25)
[1]=>
int(25)
[2]=>
int(25)
[3]=>
int(25)
}
array(4) {
[0]=>
int(26)
[1]=>
int(26)
[2]=>
int(26)
[3]=>
int(26)
}
- Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
- array(4) {
[0]=>
int(0)
[1]=>
int(0)
[2]=>
int(0)
[3]=>
int(0)
}
array(4) {
[0]=>
int(1)
[1]=>
int(1)
[2]=>
int(1)
[3]=>
int(1)
}
array(4) {
[0]=>
int(2)
[1]=>
int(2)
[2]=>
int(2)
[3]=>
int(2)
}
array(4) {
[0]=>
int(3)
[1]=>
int(3)
[2]=>
int(3)
[3]=>
int(3)
}
array(4) {
[0]=>
int(4)
[1]=>
int(4)
[2]=>
int(4)
[3]=>
int(4)
}
array(4) {
[0]=>
int(5)
[1]=>
int(5)
[2]=>
int(5)
[3]=>
int(5)
}
array(4) {
[0]=>
int(6)
[1]=>
int(6)
[2]=>
int(6)
[3]=>
int(6)
}
array(4) {
[0]=>
int(7)
[1]=>
int(7)
[2]=>
int(7)
[3]=>
int(7)
}
array(4) {
[0]=>
int(8)
[1]=>
int(8)
[2]=>
int(8)
[3]=>
int(8)
}
array(4) {
[0]=>
int(9)
[1]=>
int(9)
[2]=>
int(9)
[3]=>
int(9)
}
array(4) {
[0]=>
int(10)
[1]=>
int(10)
[2]=>
int(10)
[3]=>
int(10)
}
array(4) {
[0]=>
int(11)
[1]=>
int(11)
[2]=>
int(11)
[3]=>
int(11)
}
array(4) {
[0]=>
int(12)
[1]=>
int(12)
[2]=>
int(12)
[3]=>
int(12)
}
array(4) {
[0]=>
int(13)
[1]=>
int(13)
[2]=>
int(13)
[3]=>
int(13)
}
array(4) {
[0]=>
int(14)
[1]=>
int(14)
[2]=>
int(14)
[3]=>
int(14)
}
array(4) {
[0]=>
int(15)
[1]=>
int(15)
[2]=>
int(15)
[3]=>
int(15)
}
array(4) {
[0]=>
int(16)
[1]=>
int(16)
[2]=>
int(16)
[3]=>
int(16)
}
array(4) {
[0]=>
int(17)
[1]=>
int(17)
[2]=>
int(17)
[3]=>
int(17)
}
array(4) {
[0]=>
int(18)
[1]=>
int(18)
[2]=>
int(18)
[3]=>
int(18)
}
array(4) {
[0]=>
int(19)
[1]=>
int(19)
[2]=>
int(19)
[3]=>
int(19)
}
array(4) {
[0]=>
int(20)
[1]=>
int(20)
[2]=>
int(20)
[3]=>
int(20)
}
array(4) {
[0]=>
int(21)
[1]=>
int(21)
[2]=>
int(21)
[3]=>
int(21)
}
array(4) {
[0]=>
int(22)
[1]=>
int(22)
[2]=>
int(22)
[3]=>
int(22)
}
array(4) {
[0]=>
int(23)
[1]=>
int(23)
[2]=>
int(23)
[3]=>
int(23)
}
array(4) {
[0]=>
int(24)
[1]=>
int(24)
[2]=>
int(24)
[3]=>
int(24)
}
array(4) {
[0]=>
int(25)
[1]=>
int(25)
[2]=>
int(25)
[3]=>
int(25)
}
array(4) {
[0]=>
int(26)
[1]=>
int(26)
[2]=>
int(26)
[3]=>
int(26)
}
- Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
- Fatal error: Class 'MultipleIterator' not found in /in/TFref on line 38
Process exited with code 255. - Output for 4.4.2 - 4.4.9
- Parse error: syntax error, unexpected T_STRING, expecting '{' in /in/TFref on line 2
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
- Parse error: parse error, unexpected T_STRING, expecting '{' in /in/TFref on line 2
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `'{'' in /in/TFref on line 2
Process exited with code 255.
preferences:
237.37 ms | 401 KiB | 327 Q