Php Functions

The real power of PHP comes from its functions; it has more than 1000 built-in functions.
What is Function?.

  • Function is just like container for script. In Function we write script. When we call function
  • then store script will run. Once you have to create function. You can call this function
  • anywhere in Programme. If We are not use function then we write script again and again.

User Define Function

  • This is create by Programmer. Means Programmer self create function then call it

System Define Function

  • Library Function:- This is already built in PHP. We just call it . For Library Function read PHP Reference.

Example

Syntax:-
function functionname()
{
write code here;
}
 function functionname()
{
write code here;
}

How to call Function:
functionname(argument);

Example 1:- Example to Create Function and Call function

<?php
function show()
{
echo “Welcome User”;
}
show();
?>

Output:-
Welcome User

Example 2:- Example for Passing Parameter into Function. Note:- Parameter is just like variable. Like $name is parameter into function

Syntax:-
<?php function show($name)
 {
 echo "Your Name :".$name;
 }
   show("John"); ?>

Output:-
Your Name: John

free hd porn

Admin has written 171 articles