protected function setAmountsPrecision($array)
    {
        $amounts = explode(',', str_replace(' ', '', $array['amounts']));
        unset($array['amounts']);
        $temp = [];

        try {
            foreach ($amounts as $amount) {
                $temp[] = bcadd($amount, '0', 8);
            }

            return array_merge(
                        ['amounts' => implode(',', array_values($temp))],
                        $array
                    );
        } catch (Exception $e) {
            $e->getMessage();
        }
    }
protected function setAmountsPrecision($array)
    {
        $amounts = explode(',', str_replace(' ', '', $array['amounts']));
        unset($array['amounts']);
        $temp = [];

        try {
            foreach ($amounts as $amount) {
                $temp[] = bcadd($amount, '0', 8);
            }

            return array_merge(
                        ['amounts' => implode(',', array_values($temp))],
                        $array
                    );
        } catch (Exception $e) {
            $e->getMessage();
        }
    }
protected function setAmountsPrecision ( $ array ) { $ amounts = explode ( ',' , str_replace ( ' ' , '' , $ array [ 'amounts' ] ) ) ; unset ( $ array [ 'amounts' ] ) ; $ temp = [ ] ; try { foreach ( $ amounts as $ amount ) { $ temp [ ] = bcadd ( $ amount , '0' , 8 ) ; } return array_merge ( [ 'amounts' => implode ( ',' , array_values ( $ temp ) ) ] , $ array ) ; } catch ( Exception $ e ) { $ e -> getMessage ( ) ; } }
Verifying the presicion of the provided amounts.
You need to have the php7.0-bcmath package installed.

To install it in ubuntu run:
sudo apt-get updatesudo
apt-get install php7.0-bcmath

@param array $array

@return string|Exception
Verifying the presicion of the provided amounts . You need to have the php7 . 0 - bcmath package installed .