Lets enjoy power of PHP Function

function(): 

A set of specific program and source code which complete a specific task is function.
Function separates the complexity of a large program and provides a modular approach. There are two type of function user define function and library function. Now focus on user defines function and try to understand.
PHP Function

Syntex of PHP function :

function functionName()
{
code to be executed;

Complete Example of PHP Function


<!DOCTYPE html>
<html lang="en">
<head>
<title>IP Address</title>
<meta charset="utf-8" />
</head>
<body>
<?php
function crdt(){
$dt=date("m/D/Y");
return $dt;
}
echo crdt();
?>
</body>
</html>

 

Labels: