Types of functions in php:
Function with no arguments and no return values.
Function with no arguments and with return values.
Function with arguments and no return values.
Function with arguments and return values.
Function with no arguments and no return values.
<html>
<body>
<?php
function add()
{
$a=10;
$b=20;
Echo $a+$b;
}
add();
?>
Function with no arguments and with return values.
<html>
<body>
<?php
function add()
{
$x=10;
$y=20;
$total=$x+$y;
return $total;
}
$a=add();
echo $a;
?>
Function with arguments and no return values.
<html>
<body>
<?php
function add($x,$y)
{
$total=$x+$y;
echo $total;
}
add(10,10);
?>
Function with arguments and return values.
<html>
<body>
<?php
function add($x,$y)
{
$total=$x+$y;
return $total;
}
echo . add(10,10);
?>
Hi Sharma....The above PHP function types concepts was very nice.....
The concepts was really very useful for me and all the PHP developers....
Thanks for your helpful information....
I want to learn php.can you tell me the best website to learn php online?
Now days in PHP programming, developer prefer to use scripts which are easily available to develop basic functionality to save the time. Understanding of function is require to create custom requirement and it is necessary to know how to pass the argument and how to calculate the value in argument.