number_format
The default
thousands_separator
is
,
which is 4th parameter. Without passing something else for the
thousands_separator
parameter, the
latency
was equal to
1,511.68525
The following PHP code caused problem in MySQL
$this->latency = number_format(microtime(1)-$_SESSION['startTime'], 5);
MySQL error:
SQLSTATE[01000]: Warning: 1265 Data truncated for column 'latency' at row 1
Solution to the problem is to specify the 4th parameter as an empty string
""
to get
latency
equal to
1511.68525
$this->latency = number_format(microtime(1)-$_SESSION['startTime'], 5, '.', '');
by Valeri Tandilashvili
3 years ago
PHP
functions
0
Pro tip: use ```triple backticks around text``` to write in code fences