PHP Function

Function is used to takes input and return some output.In all languages functions are similar functionality

Type of functions

Built-In Functions : Built In function only need to call by developer they have already built in functionality, Like: file functions,string functions, array functions etc

User Define Functions : Your can create your own function as requirement, a function is calls just after creating it.


function phpfunction() {   /* Function Defination*/
echo "Blogshub is a best platform for learning";

phpfunction();  /* Function Calling */

Functions with Parameters

Like other language PHP also gives you option to pass your parameters. You can pass single as well as multiple parameters in function.In function parameters are like variables .

function PHPFunction($Parameter1, $Parameter2) {
$result = $Parameter1 + $Parameter2;
echo "Output: $result";

PHPFunction(24, 5);

Leave a Reply

Your email address will not be published. Required fields are marked *