flush() fora do foreach