Last updated 6 October 2016. Created on 23 August 2008.
Edited by reuben.bradley, vigneshbabu, mr.baileys, Senpai. Log in to edit this page.

Smaller functions doing a single task are easier to test and are more reusable.

If a function's entire source code doesn't fit within the screen of your editor, it's probably trying to do too many tasks and should be broken down into small functions.

On the other hand, if the entire source code of the function fits within the screen size, then it's more likely that everyone will be able to comprehend what that function is trying to achieve (and will be able to debug errors easily).

Looking for support? Visit the forums, or join #drupal-support in IRC.