Ad
  • Custom User Avatar

    Function stops and returns immediately after it encounters return statement, so it finishes just during the first iteration.

    To get this to work, you need to collect result of every iteration (without return), and return it after the loop, when all iterations are complete.