Tsk tsk, you forgot to correct the use of operator = instead of operator ==
I would suggest:
function func_round($n, $dec, $func = 'round') {
switch ($func) {
case 'round':
return round($n, $dec);
case 'floor':
case 'ceil':
$multiplier = pow(10, $dec);
return $func($n * $multiplier) / $multiplier;
default:
return $n;
}
}
In retrospect, a switch may be a little too much:
function func_round($n, $dec, $func = 'round') {
if ($func == 'round') {
return round($n, $dec);
} elseif ($func == 'floor' || $func == 'ceil') {
$multiplier = pow(10, $dec);
return $func($n * $multiplier) / $multiplier;
} else {
return $n;
}
}