Jump to content

[SOLVED] function naming convention?


dinosoup

Recommended Posts

Hi all.

 

I was just starting to get into Drupal and trying to understand the code. I see code like the following:

function drupal_maintenance_theme() {
  require_once './includes/theme.maintenance.inc';
  _drupal_maintenance_theme();
}

The function calls a function with the same name except with a "_" in front and that function is in the required file.

 

Does the "_" in front have any special meaning in PHP? Or is it just a function naming convention? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/99327-solved-function-naming-convention/
Share on other sites

Naming Convention (because of php4)

 

Functions and Methods

Functions and methods should be named using lowercase and words should be separated with an underscore. Functions should in addition have the grouping/module name as a prefix, to avoid name collisions between modules.

 

Private class members (meaning class members that are intended to be used only from within the same class in which they are declared; PHP 4 does not support truly-enforceable private namespaces) are preceded by a single underscore.

 

http://drupal.org/coding-standards

 

Best, Nathan

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.