28.4.2. Functions

Here is an example of a simple PHP function:

function get_lang($module) {
  global $currentlang, $language;

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.

Help us make a better PHP-Nuke HOWTO!

Want to contribute to this HOWTO? Have a suggestion or a solution to a problem that was not treated here? Post your comments on my PHP-Nuke Forum!

Chris Karakas, Maintainer PHP-Nuke HOWTO


Site Info v2.2.2

Last SeenLast Seen
  • rovshan
  • neralex
Server TrafficServer Traffic
  • Total: 379,070,019
  • Today: 19,181
Server InfoServer Info
  • Mar 22, 2019
  • 09:41 am CET