CSE :: PHP - CS
- Which one of the following PHP functions can be used to build a function that accepts any number of arguments?
<?php
function calc($price, $tax)
{
$total = $price + $tax;
}
$pricetag = 15;
$taxtag = 3;
calc($pricetag, $taxtag);
?>
<?php
function calc($price, $tax="")
{
$total = $price + ($price * $tax);
echo "$total";
}
calc(42);
?>
<?php
function a()
{
function b()
{
echo 'I am b';
}
echo 'I am a';
}
a();
a();
?>
<?php
function a()
{
function b()
{
echo 'I am b';
}
echo 'I am a';
}
b();
a();
?>
<?php
$op2 = "blabla";
function foo($op1)
{
echo $op1;
echo $op2;
}
foo("hello");
?>