Wednesday, August 15, 2012

Lets enjoy power of PHP Function

function(): 

A set of specific program and source code which complete a specific task is function.
Function separates the complexity of a large program and provides a modular approach. There are two type of function user define function and library function. Now focus on user defines function and try to understand.
PHP Function

Syntex of PHP function :

function functionName()
{
code to be executed;

Complete Example of PHP Function


<!DOCTYPE html>
<html lang="en">
<head>
<title>IP Address</title>
<meta charset="utf-8" />
</head>
<body>
<?php
function crdt(){
$dt=date("m/D/Y");
return $dt;
}
echo crdt();
?>
</body>
</html>

 

PickMe
Delicious Save this on Delicious

10 comments :

  1. <?php
    function star() //no parameter
    {
    for($i=1;$i<=40;$i++)
    {
    echo "*"; //no return value
    }
    echo"<br>";
    }
    star(); //function call but no argument
    star();
    ?>

    ReplyDelete
  2. <?php
    function reverse($num) //parameter receive
    {
    for($mod=0,$rev=0;$num>0;$num=(int)($num/10))
    {
    $mod=$num%10;
    $rev=$rev*10+$mod;
    }
    echo "Out put in function"."<br>";
    echo "Reverse=".$rev;
    //function no return .
    }
    $number=365;
    reverse($number); //argument passing
    ?>

    ReplyDelete
  3. I actually enjoyed reading through this posting.Many thanks.
















    Function Point Estimation Training

    ReplyDelete
  4. Thanks for your informative article on software testing. Your post helped me to understand the future and career prospects in software testing. Keep on updating your blog with such awesome article. Software testing training

    ReplyDelete
  5. Nice information about the load testing!!! I prefer Loadrunner automation testing tool to validate the performance of software application/system under actual load. Loadrunner training institute in Chennai | Loadrunner course in Chennai

    ReplyDelete

If you have any Question , Suggestion or idea then please comment regarding the post.