出于某种原因,在使用preg_match('/^[-+*/^()\s0-9]+$/', $formula
I throw an Unknown modifier '^'
While trying to run7 + 6c
时,我会返回错误信息?
完整片段
if (! preg_match('/^[-+*/^()\s0-9]+$/i', $formula ))
{
$this->log(array('fatal', $formula, 'Contains unacceptable values...'));
}
$formula = '(7 + 6) / 9'; # 1
$formula = '7 * 6 ^ 2' # 252
$formula = '1c + 2c' # boom, but no trap =/