Hello,
I am new, just learning PHP. I would like appreciate if someone could assist me with the following two questions:
(1) I will like to write a function named whatever, that contains one required and one default parameter. The function multiplies the two values.
what(50); // This function call must return the value 450
what(12,12)
Below are my codes but not working. P lease kindly assist me how to achieve the above requirement. Where I mine getting it wrong:
function what($w, $u){
$value =($w*$u);
return $value;
}
$returnValue = what(50, 9);
//echo $returnValue;
function what($what, $num=12*12){
echo $what;
}
(2)I want to a function named changing that make use of a variable-length parameter list. I want to use the function to produce the following output:
Function received 5 arguments
Argument 0 = H
Argument 1 = e
Argument 2 = l
Argument 3 = l
Argument 4 = o
Function received 8 arguments
Argument 0 = F
Argument 1 = e
Argument 2 = e
Argument 3 = -
Argument 4 = F
Argument 5 = i
Argument 6 = -
Argument 7 = F
Argument 8 = 0
Thanks for your assistance.