I think you want to `break` out of the loop. Calling `exit` stops the whole PHP process resulting in nothing else, not even another function, being run. Maybe you also just want to `return`?