My Community

Work At Home Free Classifieds => Post Your Products & Services Here => Topic started by: Sharmait007 on September 15, 2011, 05:18:35 AM

Title: cegonsoft pvt ltd | Types of function in php | php tutorial
Post by: Sharmait007 on September 15, 2011, 05:18:35 AM
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);
?>


--------------------
Visit Us At:http://www.cegonsoft.com (http://www.cegonsoft.com)
cegonsoft  (http://www.cegonsoft.com/php&mysql.php)