1--TEST-- 2SPL: iterator_to_array() supports arrays. 3--FILE-- 4<?php 5 6var_dump(iterator_to_array([])); 7var_dump(iterator_to_array([1])); 8var_dump(iterator_to_array(['a' => 1, 'b' => 2, 5 => 3])); 9var_dump(iterator_to_array([], false)); 10var_dump(iterator_to_array([1], false)); 11var_dump(iterator_to_array(['a' => 1, 'b' => 2, 5 => 3], false)); 12 13?> 14--EXPECT-- 15array(0) { 16} 17array(1) { 18 [0]=> 19 int(1) 20} 21array(3) { 22 ["a"]=> 23 int(1) 24 ["b"]=> 25 int(2) 26 [5]=> 27 int(3) 28} 29array(0) { 30} 31array(1) { 32 [0]=> 33 int(1) 34} 35array(3) { 36 [0]=> 37 int(1) 38 [1]=> 39 int(2) 40 [2]=> 41 int(3) 42} 43