Here is an example of a simple PHP function:
function get_lang($module) {
global $currentlang, $language;
HERE GOES THE FUNCTION CODE
}
|
It has the following structure, common to every PHP function:
the function name, preceded by the keyword "function",
the function parameters in the parenthesis,
the global variables that we intend to use in this function, registered through the "global" keyword (we cannot use any global variables, if we do not register them as such),
the curly brackets that include the function's content
Functions may be called from anywhere in the PHP code. See also PHP functions.
| Last updated Sun Aug 7 21:14:12 CEST 2005 | Permalink: http://www.karakas-online.de/EN-Book/php-functions.html | All contents © 2004 Chris Karakas, Claudio Erba |