At times you have to write little utility functions which will have a general scope (not restricted to the module you are working on) so that it can be called from anywhere in the project.
I know I can write it anywhere and include the php file from the caller, but is there a convention followed in Drupal?
For e.g. I am working on xyz.module which does xyz thing which will have a silly
function startsWith($haystack, $needle) // case-insensitive startsWith
{
return strncasecmp($haystack, $needle, strlen($needle)) === 0;
}
Where shall I write that function?