diff --git a/SqlBuilder.php b/SqlBuilder.php index 2861d39..dc4885a 100644 --- a/SqlBuilder.php +++ b/SqlBuilder.php @@ -189,7 +189,7 @@ class SqlBuilder extends Component if (is_null($value)) { return $keys; } - if (is_string($value) && $this->isMath($value)) { + if ($this->isMath($value)) { $keys[] = $key . '=' . $key . ' ' . $value; } else { $this->query->pushParam($value); @@ -205,7 +205,7 @@ class SqlBuilder extends Component */ private function isMath(string $value): bool { - return str_starts_with($value, '+ ') || str_starts_with($value, '- '); + return (bool)preg_match('/^[+|-]\s\d+$/', $value); }