PHP Functions

The real power of PHP comes from its functions. There are more than about 1000 built-in functions available in
PHP, which is much enough to perform a lot of task.

PHP5 Functions

You are free to create your own functions (user-defined functions). A function is basically a block of code that can be used to perform some
particular task in your program.

Create a Function in PHP

A function in PHP is created with the help of function keyword. Here is the general form to declare a function in PHP:

function functionName()
{
code to be executed here;
}

Here, function is the keyword used in declaring the function in PHP, functionName is the name of the function. You can give a name to the
function starting with a letter or underscore (but not with a number).

PHP Functions Example

Here is an example, creates a function named writeMsg(), to write a message as output: