Much like the manual, use an equals () sign in your definition of the parameters:=
function dosomething($var1, $var2, $var3 = 'somevalue'){
// Rest of function here...
}
Make the function take one parameter: an array. Pass in the actual parameters as values in the array.
Edit: the link in Pekka's comment just about sums it up.
Your post is correct.
Unfortunately, if you need to use an optional parameter at the very end of the parameter list, you have to specify everything up until that last parameter. Generally if you want to mix-and-match, you give them default values of or '', and don't use them inside the function if they are that default value.null