xref: /PHP-7.1/Zend/tests/generators/xrange.phpt (revision c9709bfb)
1--TEST--
2Simple generator xrange() test
3--FILE--
4<?php
5
6function xrange($start, $end, $step = 1) {
7	for ($i = $start; $i <= $end; $i += $step) {
8		yield $i;
9	}
10}
11
12foreach (xrange(10, 20, 2) as $i) {
13	var_dump($i);
14}
15
16?>
17--EXPECT--
18int(10)
19int(12)
20int(14)
21int(16)
22int(18)
23int(20)
24