xref: /php-src/ext/spl/tests/array_011.phpt (revision f8d79582)
1--TEST--
2SPL: ArrayIterator, LimitIterator and string keys
3--FILE--
4<?php
5
6$a = array('zero' => 0, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5);
7//foreach (new ArrayIterator($a) as $k => $v)
8foreach (new LimitIterator(new ArrayIterator($a), 1, 3) as $k => $v)
9{
10    var_dump(array($k, $v));
11}
12
13?>
14--EXPECT--
15array(2) {
16  [0]=>
17  string(3) "one"
18  [1]=>
19  int(1)
20}
21array(2) {
22  [0]=>
23  string(3) "two"
24  [1]=>
25  int(2)
26}
27array(2) {
28  [0]=>
29  string(5) "three"
30  [1]=>
31  int(3)
32}
33