Sail E0 Webinar
Question
What will be the output of the following PHP code?
< ?php
function calc($price, $tax="")
{
$total = $price + ($price * $tax);
echo "$total";
}
calc(42);
?>
Options:
A .  Error
B .  0
C .  42
D .  84
Answer: Option C


You can designate certain arguments as optional by placing them at the end of the list and assigning them a default value of nothing.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers