summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/xrange.phpt
blob: 4d8b60fa909a82e0b1b29398d1af12a48ef8d5cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--TEST--
Simple generator xrange() test
--FILE--
<?php

function xrange($start, $end, $step = 1) {
	for ($i = $start; $i <= $end; $i += $step) {
		yield $i;
	}
}

foreach (xrange(10, 20, 2) as $i) {
	var_dump($i);
}

?>
--EXPECT--
int(10)
int(12)
int(14)
int(16)
int(18)
int(20)