diff --git a/jzon.inc.php b/jzon.inc.php index 081aba7..d9e493b 100644 --- a/jzon.inc.php +++ b/jzon.inc.php @@ -293,10 +293,16 @@ class jzonParser } $str_num = substr($this->in, $start, $this->c - $start); + + $fval = floatval($str_num); + $ival = intval($str_num); + if($is_float) - $out = floatval($str_num); + $out = $fval; + else if(($ival < PHP_INT_MAX && $ival > PHP_INT_MIN) || strval($ival) === $str_num) + $out = $ival; else - $out = intval($str_num); + $out = $fval; } private function parse_true(&$out)