Why some functions begin by an underscore. I wonder if it's not to done it overidable but i'm not sure.
Anybody can give me somes precisions about it ?
I looked this up last week as I was not sure. It is an old convention that private functions intended for internal use start with an underscore. I am not sure whether that came from earlier versions of php or from C.
I haven't seen any ending with an underscore but it is probably something similar.
As far as I am aware, it does not actually restrict the use of the function.
It doesn't restrict the use of the function by other modules, but the return value of the function should not be depended on by other modules. Basically, prefixing the function name with an underscore indicates that that function should only be used by the module that it is contained within, as the output could change with a future version of the module. The developer is making no commitment to maintain the output of the function in its current form.
Of course this could happen in any module with any function, but this is just explicitly saying so.
Jaypan is an Acquia certified Developer, Back End Specialist, and Front End Specialist
The developer is saying "really, do not call this function directly".
It may indicate that there is a better, more public API call you should use instead - you are messing with internals you shouldn't.
Sometimes it can't be avoided, but the expectation is that your code may break at any future point if the target module changes.
It's because PHP (non object-oriented) didn't have a way of declaring private/protected namespaces or functions.
This would be private if it could, but it can't, so I'll just put up a "Keep Out" sign
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Hi and thanks for your answer,
Well, i thought it means that you can use the function with a hook, so i was on the wrong way !
Drupal is a registered trademark of Dries Buytaert.