Code: Select all
function printValues($a,$b="Second",$c="Third") {
echo "$a -- $b -- $c";
}
Is it possible?
FYI
Sometimes i would wanna pass value for $b and sometime $c... So changing the position of the parameter wont work.
Moderator: General Moderators
Code: Select all
function printValues($a,$b="Second",$c="Third") {
echo "$a -- $b -- $c";
}
Code: Select all
function printValues($a,$b='',$c='') {
if ($b == '') $b = "Second";
if ($c == '') $c = "Third";
echo "$a -- $b -- $c";
}