PHP Function@ Shwetank education.com

Definition – 
A function will be executed by a call to the function.
Types of Function
1- User- define

2- Pre- define

Syntax
function functionName()
{
code to be executed here;
}

Output
<?php
function writeName()
{
echo “Shwetank Education”;
}

echo “My name is “;
writeName();
?>

Script   Isset Function in php
The isset() function is used to check whether a variable is set or not. Returns true if it is and false if it is not. Please note the the isset() function only works on variables and it’s use on anything else will produce errors.

Example With isset Function

<?php
$username=”makemyday”;
if(isset($username))
{

echo “This variable is set”;
}
else
{
echo “This variable is not set”;
}
?>

OutPut:

Try it

Script   Unset Function in php
The unset() function is used to destroy specified variables.It can be used to destroy single variables, multiple variables or an element in an array.

Example
<?php
unset($username);
?>

Output: