Blog Introductions

In this  blog contains tutorials about  HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials,  Examples, Source code,Learning,
Tips and Software development  services.Php Functions and Passing parameter to function |  Php tutorials Bestitworriors 


Php Functions and Passing parameter to function


Php tutorials



Php Functions and Passing parameter to function |  Php tutorials Bestitworriors -Function are the block of combined statements that are written conbine and use repeately in the code.Function can be use multipute time in the code.Functon do not work untill call them.Function don't load with the page.Php functions also play a effective role in the code.You can perform different task in different way using functions.You can call same function to multiple time in the code

Some Key Points of PHP Functions


  1. Functions are block of code
  2. Functions work on calling the function name
  3. You can send parameters to the function
  4. Function work on multiple parameter
  5. Function also return the result or execute inside of function

Code



< ?php

function
printfun()
{
echo
"Hello Bestitworrior";
}

printfun(); // call
the
function

echo
"<br>";

function
Month($mname) {
echo
"Month Name is $mname <br>";
}

Month("January");
Month("Feburary");
Month("March");
Month("April");

echo
"<br>";

function
operation($value1,$value2,$op)
{

if ($op == '+')
{
$result = $value1 + $value2;
}
else if ($op == "*")
{
$result = $value1 * $value2;
}
else {
$result = 0;
}
return $result;
}

$ans = operation(2, 4, '+');
echo
"Addition of 2 and 4 is :".$ans;
echo
"<br>";

$ans1 = operation(2, 4, '*');
echo
"Multiplication of 2 and 4 is :".$ans1;
echo
"<br>";








? >


OutPut

Hello Bestitworrior
Month Name is January
Month Name is Feburary
Month Name is March
Month Name is April
Addition of 2 and 4 is :6
Multiplication of 2 and 4 is :8




I hope You really enjoyed this blog . I try my best to make every thing is easy and helpfull to provide to public .You will get more blog about the Programing project and code . Thanks for visiting my blog if you have any querry related to this you can comment here i will try my best to response you back about Php Functions and Passing parameter to function |  Php tutorials Bestitworriors