I'd like to make my life easier avoiding to pass some preset variables to a function in PHP.
For example, this works:
function test1($var2,$var3,$var1=1){
return '$var1='.$var1.'+$var2='.$var2.'+$var3'.$var3;
}
echo test1($var2=2,$var3=3);
#$var1=1+$var2=2+$var33
But this doesn't (without the warnings):
function test($var1=1,$var2,$var3){
return '$var1='.$var1.'+$var2='.$var2.'+$var3'.$var3;
}
echo test($var2=2,$var3=3);
#Warning: Missing argument 3 for test(), called in /var/www/atpc.info/f/f/m/t.php on line 6 and defined in /var/www/atpc.info/f/f/m/t.php on line 3
#Notice: Undefined variable: var3 in /var/www/atpc.info/f/f/m/t.php on line 4
#$var1=2+$var2=3+$var3
Maybe the only way to make this to happen is always to put to the end of the line the preset variables. Is it?
Thanks for any light.