A function is a group of statements that will do certain tasks.
When we develop a module in a project , we may need to implement certain tasks(block of statements ) more than once . Writing same block of codes more than once is not at all a good practice . Instead we can give a name to that block and can use them whenever necessary . When we define a block with a name , it is known as function .
echo “Error”; // can be on or more lines of statements
function – a keyword
funation_name – Any desired name(Should be meaningful)
Once the function is desfined , You can can invoke it by calling its name
<?php funation_name(); ?> // It will print the text “ Error”
A function can have arguments . When a fuction is define using arguments in it , we should pass the values when calling the it .
<?php function_sum(7,8); ?> // It will display 15 as the result .
Note : We should not use any Builtin function name as the function name