Bug #79977 [Opn->Nab]: Compatibily with locale
Edit report at https://bugs.php.net/bug.php?id=79977&edit=1
ID: 79977
Updated by: peehaa@php.net
Reported by: xyz at ed48 dot com
Summary: Compatibily with locale
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
Operating System: Windows
PHP Version: 8.0.0beta1
Block user comment: N
Private report: N
New Comment:
This is by design: https://wiki.php.net/rfc/locale_independent_float_to_string
Previous Comments:
------------------------------------------------------------------------
[2020-08-14 19:37:03] xyz at ed48 dot com
Description:
------------
In PHP 7.4.9 the script runs with no problem, however, in PHP 8.0.0 beta1, it does not obey LOCALE.
Test script:
---------------
<?php
$arr01 = [ 2.876, 8.0, 18.91, 32.12 ];
echo 'The given ARRAY:<br>';
print_r($arr01);
echo '<br><br>The SUM:<br>';
setlocale(LC_NUMERIC, 'pt-pt', 'pt_PT');
$sarr01 = array_sum($arr01);
echo $sarr01 . '<br>';
?>
Expected result:
----------------
61,906
Actual result:
--------------
The SUM (PHP 7.4.9):
61,906
The SUM (PHP 8.0.0 b1):
61.906
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79977&edit=1
Thread (2 messages)