Function

Function:
The function is used to separate out a section of code that performs a particular task. for example, maybe you often need to look up a date and return it in a certain format.that would be a good example to turn into a function.they can also return value to the calling code.

for example:
<?php
function longdate($timestamp)
{
return date("L F JS Y",$timestamp);
} 
?>
to output of today's date using function,place the following call in your code.
echo longdate(time());
Translate »