What is the correct way to create a function in PHP code example
Example 1: function php
function functionName() {
//code to be executed;
}
Example 2: execute function php
function functionName() {
//code to be executed;
}
functionName();
Example 3: 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>