stash foreach with function callback