Bug #85741
Updated by Georg Ringer over 6 years ago
<pre> /** * @param integer|float $left * @param string $operator * @param integer|float $right * @return integer|float */ protected static function evaluateOperation($left, $operator, $right) { if ($operator === '%') { return (float)$left % (float)$right; } elseif ($operator === '-') { return (float)$left - (float)$right; } elseif ($operator === '+') { return (float)$left + (float)$right; } elseif ($operator === '*') { return (float)$left * (float)$right; } elseif ($operator === '/') { return (integer) $right !== 0 ? (float)$left / (float)$right : 0; } elseif ($operator === '^') { return pow((float)$left, (float)$right); } return 0; } </pre>