Functions with Parameters
Now, the first sample PHP function did something very simple that it displayed a string that does not change and was not influenced by any parameters. We then move to show functions with one or more parameters that make them more powerful and diverse. That is done by placing these parameters inside the “()”.
function displayMyName($myfName,$mark)
{
echo $myfName . "Dela Cruz" . $mark . "
“;
}
echo “My name is”;
$displaymyName(“Juan”,”.”)
echo “My name is”;
$displaymyName(“Jack”,”.”)
echo “My name is”;
$displaymyName(“June”,”.”)
?>
The output of the sample would be :
My name is Juan Dela Cruz
My name is Jack Dela Cruz
My name is June Dela Cruz
Filed under: Information by Avatar
