Is it possible to pass an operator to a function? Like this:
function operation($a, $b, $operator = +) {
return $a ($operator) $b;
}
I know I could do this by passing $operator as a string and use switch { case '+':... }. But I was just curious.