If your question is about the default value of parameters in PHP functions, it doesn't work that way.
function sum($num1=20,$num2=10)
{
$sum=$num1+$num2;
echo $sum;
}
sum('',40);
Your function sum requires two parameters. You made these parameters optional by adding default values. These default values are taken into account
if there is no parameter.
This means that
sum();
works, and will use both your default parameters. It will echo the result of 10 + 20, ie. 30.
Now you can try
sum(70);
This will echo 80, because your first parameter is defined ( 70 ) and the second isn't, therefore $num2 takes the default value, which is 10.
In addition to that, you can't input a value for the second parameter only and have the first parameter using the default value.
EDIT : I did a quick research and found a good way to make this work : PHP Function with Optional Parameters