Webmaster Forums - Website and SEO Help

Web Development and Design => Database, Server, Coding and Website Administration => Topic started by: Sharmait007 on September 19, 2011, 07:30:29 AM

Title: Types of functions in php | php tutorial
Post by: Sharmait007 on September 19, 2011, 07:30:29 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);
?>
Title: Types of functions in php | php tutorial
Post by: Quickgun12 on September 23, 2011, 05:47:09 AM
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....

Title: Re: Types of functions in php | php tutorial
Post by: jordanhustin on December 28, 2011, 06:39:19 AM
I want to learn php.can you tell me the best website to learn php online?
Title: Re: Types of functions in php | php tutorial
Post by: lillianabe on January 27, 2012, 01:57:39 AM
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.