I made a function that loops some variables (that are in an array), but I want those vars to be optional, allowing me to give the function the number of parameters I wish.
But if I pass only 1 or 2 vars to the function (instead of 3), it gives me an error, saying "Missing argument for affichecho()...".
I know Php4 allows optional parameters in a user defined function, but I don't really understand how to do, the manual isn't that clear on this point.
Here is my function ($echo 2 and $echo3 must be optional) :
function affichecho($echo, $echo2, $echo3){
$ii=count($echo);
$ii2=count($echo2);
$ii3=count($echo3);
for ($i=1; $i<=$ii; $i++){
echo "$echo[$i]";
for ($i2=1; $i2<=$ii2; $i2++){
echo "$echo2[$i2]";
for ($i3=1; $i3<=$ii3; $i3++){
echo "$echo3[$i3]";
}
}
}
}
Thank you for your help.