Is there a limit in PHP to the length of a variable name or function name?
Generally, such a limit is imposed by the threat of violence from other folks who interact with your code.
From the documentation:
Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores
The same is the case for function names, as stated here.