Friday, November 2, 2012

Function in PHP


        There are several functions that can be executed in PHP are:

1. Echo () is used to display the parameters to the screen.

2. Include () is used to invoke the name of the file to be executed.

3. Strlen () is used to calculate the length of a value that is the result of type integer.

4. Date () is used to process and display the date of the computer system.

5. Getdate () is used to generate the date and result of type array.

6. Isset () is used to return true if the variable contains data and is false if the variable is empty.

           In addition to the above functions, we can also create your own function. Suppose the function to calculate the area, circumference, volume count or the other functions we want.

Example :

<?php
function kl($p,$l)
{
$kel = 2 * ($p + $l);
return ($kel);
}

?


<?php
function ls($p,$l)
{
$luas = $p * $l;
return ($luas);
}
 
?

Execute :

kl();

ls();

No comments:

Post a Comment