how to use function in php code example
Example 1: function php
function functionName() {
}
Example 2: how to define function in php
<?php
function writeMsg() {
echo "Hello world!";
}
writeMsg();
?>
Example 3: execute function php
function functionName() {
}
functionName();
Example 4: php function
<html>
<head>
<title>Writing PHP Function with Parameters</title>
</head>
<body>
<?php
function addFunction($num1, $num2) {
$sum = $num1 + $num2;
echo "Sum of the two numbers is : $sum";
}
addFunction(10, 20);
?>
</body>
</html>