reverse all levels with foreach defined