private function number_format($number, $decimal_precision = 0, $decimals_separator = '.', $thousands_separator = ',') {
        $number = explode('.', str_replace(' ', '', $number));
        $number[0] = str_split(strrev($number[0]), 3);
        $total_segments = count($number[0]);
        for ($i = 0; $i < $total_segments; $i++) {
            $number[0][$i] = strrev($number[0][$i]);
        }
        $number[0] = implode($thousands_separator, array_reverse($number[0]));
        if (!empty($number[1])) {
           $number[1] = round($number[1], $decimal_precision);
        }
        return implode($decimals_separator, $number);
    }
private function number_format($number, $decimal_precision = 0, $decimals_separator = '.', $thousands_separator = ',') {
        $number = explode('.', str_replace(' ', '', $number));
        $number[0] = str_split(strrev($number[0]), 3);
        $total_segments = count($number[0]);
        for ($i = 0; $i < $total_segments; $i++) {
            $number[0][$i] = strrev($number[0][$i]);
        }
        $number[0] = implode($thousands_separator, array_reverse($number[0]));
        if (!empty($number[1])) {
           $number[1] = round($number[1], $decimal_precision);
        }
        return implode($decimals_separator, $number);
    }
private function number_format ( $ number , $ decimal_precision = 0 , $ decimals_separator = '.' , $ thousands_separator = ',' ) { $ number = explode ( '.' , str_replace ( ' ' , '' , $ number ) ) ; $ number [ 0 ] = str_split ( strrev ( $ number [ 0 ] ) , 3 ) ; $ total_segments = count ( $ number [ 0 ] ) ; for ( $ i = 0 ; $ i < $ total_segments ; $ i ++ ) { $ number [ 0 ] [ $ i ] = strrev ( $ number [ 0 ] [ $ i ] ) ; } $ number [ 0 ] = implode ( $ thousands_separator , array_reverse ( $ number [ 0 ] ) ) ; if ( ! empty ( $ number [ 1 ] ) ) { $ number [ 1 ] = round ( $ number [ 1 ] , $ decimal_precision ) ; } return implode ( $ decimals_separator , $ number ) ; }
format number for change to word

@param string $number
@param int $decimal_precision
@param string $decimals_separator
@param string $thousands_separator
@return string
format number for change to word