This is because $use_keys
is true by default (since 5.1), clobbering your array keys as it's being flattened. You need to disable the setting like this:
print_r(iterator_to_array($it, false));
// ^^^^^
If you're running PHP < 5.2.1 you're basically screwed ;-)