Move flatten_array from global to a common class
Do not close php-files