Q:

php function with parameters

function functionName() {
    //code to be executed;
}
functionName();
3
// functions require 'function' keyword
// separate the parameters with a comma
function addFunction($num1, $num2) {
	$sum = $num1 + $num2;
	echo "Sum of the two numbers is : $sum";
}

addFunction(1, 2); // echoes: Sum of the two numbers is : 3
1
function familyName($fname) {
	echo $fname;
}

familyName("Jani"); //Outputs: Jani
0

New to Communities?

Join the community