Answer & Solution
Answer: Option B
Solution:
Passing arguments to a function in PHP allows the function to accept input data, which can then be processed within the function.
<?php
function greet($name = "Guest") {
return "Hello, $name!";
}
echo greet("Alice");
?
<?php
function add($a, $b) {
return $a + $b;
}
$result = add(5, 3);
echo $result;
?
<?php
function sum($a, $b = 5) {
return $a + $b;
}
echo sum(3);
?