Well Dynamic values can be any where in the function arguments, and also can be the first ones. But the best practice is to keep them at the end, so you dont have to specify the optional parameter every time you call the function.
I also have changed the echo inside the function to return, this is also a best practice.
$isbilling = true;
function retrieve_address($dbh, $customer_id, $isbilling=false){
return $isbilling; //false
}
$returned = retrieve_address($dbh, $customer_id, $isbilling);
So by this you can also do the following
// will return true or false
if(retrieve_address($dbh, $customer_id, $isbilling)){
// if it is true, your code
}else{
// if it is false
}
or
$returned = retrieve_address($dbh, $customer_id, $isbilling);
if(returned)){
// if it is true, your code
}else{
// if it is false
}