[BUGFIX] Replace calls to the deprecated PHP function each()