Created
January 26, 2024 16:30
-
-
Save zhanglianxin/fc7bf1f492038100cb2ee809a1ddf879 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('arr_sum')) { | |
/** | |
* Replacement with bc math function for internal array_sum | |
* | |
* @param array $arr | |
* @param int $scale | |
* | |
* @return mixed | |
*/ | |
function arr_sum(array $arr, int $scale = 2) | |
{ | |
bcscale($scale); | |
return array_reduce($arr, 'bcadd'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment