php Function

PHP Functions offer a convenient way of running frequently performed operations. In addition to the large number of built-in functions, PHP lets you create your own. The advantages are that you write the code only once, rather than needing to retype it everywhere you need it.

Php function not only speeds up your development time, but also makes your code easier to read and maintain. If there's a problem with the code in your function, you update it in just one place rather than hunting through your entire site. Moreover, functions usually speed up the processing of your pages.

Function Syntax :

function functionName()
executed Part;


This is User define function name

executed Part

This part you can write another PHP code

Function Example :

function sayHi()
echo 'Hi!';

Out Put


In the sayHi is a user define function .This function will provide output "Hi"

Here have some function arguments type.

Here have some function type.