Introduction
For arbitrary precision mathematics PHP offers the Binary Calculator which supports numbers of any size and precision, represented as strings.
For arbitrary precision mathematics PHP offers the Binary Calculator which supports numbers of any size and precision, represented as strings.
Коментарии
The regular expression is not quite right as I testing.
The number 20.00000509 which not match /^[+-]?[0]*[1-9]*[.]?[0-9]*$/ will pass the bcmatch format.
I think reference to source in the php_str2num function will be better. It is more like /^[+-]?(0|[1-9][0-9]*)[.]?[0-9]*$/ to me.
https://github.com/php/php-src/blob/master/ext/bcmath/bcmath.c