@@ -1096,9 +1096,8 @@ PHP_FUNCTION(number_format)
1096
1096
{
1097
1097
double num ;
1098
1098
zend_long dec = 0 ;
1099
- char * thousand_sep = NULL , * dec_point = NULL ;
1100
- char thousand_sep_chr = ',' , dec_point_chr = '.' ;
1101
- size_t thousand_sep_len = 0 , dec_point_len = 0 ;
1099
+ char * thousand_sep = "," , * dec_point = NULL ;
1100
+ size_t thousand_sep_len = 1 , dec_point_len = 0 ;
1102
1101
1103
1102
ZEND_PARSE_PARAMETERS_START (1 , 4 )
1104
1103
Z_PARAM_DOUBLE (num )
@@ -1108,30 +1107,13 @@ PHP_FUNCTION(number_format)
1108
1107
Z_PARAM_STRING_OR_NULL (thousand_sep , thousand_sep_len )
1109
1108
ZEND_PARSE_PARAMETERS_END ();
1110
1109
1111
- switch (ZEND_NUM_ARGS ()) {
1112
- case 1 :
1113
- RETURN_STR (_php_math_number_format (num , 0 , dec_point_chr , thousand_sep_chr ));
1114
- break ;
1115
- case 2 :
1116
- RETURN_STR (_php_math_number_format (num , (int )dec , dec_point_chr , thousand_sep_chr ));
1117
- break ;
1118
- case 4 :
1119
- if (dec_point == NULL ) {
1120
- dec_point = & dec_point_chr ;
1121
- dec_point_len = 1 ;
1122
- }
1123
-
1124
- if (thousand_sep == NULL ) {
1125
- thousand_sep = & thousand_sep_chr ;
1126
- thousand_sep_len = 1 ;
1127
- }
1128
-
1129
- RETVAL_STR (_php_math_number_format_ex (num , (int )dec ,
1130
- dec_point , dec_point_len , thousand_sep , thousand_sep_len ));
1131
- break ;
1132
- default :
1133
- WRONG_PARAM_COUNT ;
1110
+ if (dec_point == NULL ) {
1111
+ char dec_point_chr = '.' ;
1112
+ dec_point = & dec_point_chr ;
1113
+ dec_point_len = 1 ;
1134
1114
}
1115
+
1116
+ RETURN_STR (_php_math_number_format_ex (num , (int )dec , dec_point , dec_point_len , thousand_sep , thousand_sep_len ));
1135
1117
}
1136
1118
/* }}} */
1137
1119
0 commit comments