2
2
Test number_format() - test function with different decimal places
3
3
--FILE--
4
4
<?php
5
+
6
+ define ("MAX_INT32 " , 2147483647 );
7
+ define ("MIN_INT32 " , -2147483647 - 1 );
8
+
5
9
$ values = array (
6
10
1.5151 ,
7
11
15.151 ,
@@ -21,8 +25,8 @@ $values = array(
21
25
-999999 ,
22
26
999999.0 ,
23
27
-999999.0 ,
24
- PHP_INT_MAX ,
25
- PHP_INT_MIN ,
28
+ MAX_INT32 ,
29
+ MIN_INT32 ,
26
30
);
27
31
28
32
$ decimals = array (0 , 1 , 2 , 3 , 4 , 5 , -1 , -2 , -3 , -4 , -5 );
@@ -255,27 +259,27 @@ testing float(-999999)
255
259
... with decimal places of -3: string(10) "-1,000,000"
256
260
... with decimal places of -4: string(10) "-1,000,000"
257
261
... with decimal places of -5: string(10) "-1,000,000"
258
- testing int(9223372036854775807 )
259
- ... with decimal places of 0: string(25 ) "9,223,372,036,854,775,807 "
260
- ... with decimal places of 1: string(27 ) "9,223,372,036,854,775,807 .0"
261
- ... with decimal places of 2: string(28 ) "9,223,372,036,854,775,807 .00"
262
- ... with decimal places of 3: string(29 ) "9,223,372,036,854,775,807 .000"
263
- ... with decimal places of 4: string(30 ) "9,223,372,036,854,775,807 .0000"
264
- ... with decimal places of 5: string(31 ) "9,223,372,036,854,775,807 .00000"
265
- ... with decimal places of -1: string(25 ) "9,223,372,036,854,775,810 "
266
- ... with decimal places of -2: string(25 ) "9,223,372,036,854,775,800 "
267
- ... with decimal places of -3: string(25 ) "9,223,372,036,854,776 ,000"
268
- ... with decimal places of -4: string(25 ) "9,223,372,036,854,780 ,000"
269
- ... with decimal places of -5: string(25 ) "9,223,372,036,854,800 ,000"
270
- testing int(-9223372036854775808 )
271
- ... with decimal places of 0: string(26 ) "-9,223,372,036,854,775,808 "
272
- ... with decimal places of 1: string(28 ) "-9,223,372,036,854,775,808 .0"
273
- ... with decimal places of 2: string(29 ) "-9,223,372,036,854,775,808 .00"
274
- ... with decimal places of 3: string(30 ) "-9,223,372,036,854,775,808 .000"
275
- ... with decimal places of 4: string(31 ) "-9,223,372,036,854,775,808 .0000"
276
- ... with decimal places of 5: string(32 ) "-9,223,372,036,854,775,808 .00000"
277
- ... with decimal places of -1: string(26 ) "-9,223,372,036,854,775,810 "
278
- ... with decimal places of -2: string(26 ) "-9,223,372,036,854,775,800 "
279
- ... with decimal places of -3: string(26 ) "-9,223,372,036,854,776 ,000"
280
- ... with decimal places of -4: string(26 ) "-9,223,372,036,854,780 ,000"
281
- ... with decimal places of -5: string(26 ) "-9,223,372,036,854,800 ,000"
262
+ testing int(2147483647 )
263
+ ... with decimal places of 0: string(13 ) "2,147,483,647 "
264
+ ... with decimal places of 1: string(15 ) "2,147,483,647 .0"
265
+ ... with decimal places of 2: string(16 ) "2,147,483,647 .00"
266
+ ... with decimal places of 3: string(17 ) "2,147,483,647 .000"
267
+ ... with decimal places of 4: string(18 ) "2,147,483,647 .0000"
268
+ ... with decimal places of 5: string(19 ) "2,147,483,647 .00000"
269
+ ... with decimal places of -1: string(13 ) "2,147,483,650 "
270
+ ... with decimal places of -2: string(13 ) "2,147,483,600 "
271
+ ... with decimal places of -3: string(13 ) "2,147,484 ,000"
272
+ ... with decimal places of -4: string(13 ) "2,147,480 ,000"
273
+ ... with decimal places of -5: string(13 ) "2,147,500 ,000"
274
+ testing int(-2147483648 )
275
+ ... with decimal places of 0: string(14 ) "-2,147,483,648 "
276
+ ... with decimal places of 1: string(16 ) "-2,147,483,648 .0"
277
+ ... with decimal places of 2: string(17 ) "-2,147,483,648 .00"
278
+ ... with decimal places of 3: string(18 ) "-2,147,483,648 .000"
279
+ ... with decimal places of 4: string(19 ) "-2,147,483,648 .0000"
280
+ ... with decimal places of 5: string(20 ) "-2,147,483,648 .00000"
281
+ ... with decimal places of -1: string(14 ) "-2,147,483,650 "
282
+ ... with decimal places of -2: string(14 ) "-2,147,483,600 "
283
+ ... with decimal places of -3: string(14 ) "-2,147,484 ,000"
284
+ ... with decimal places of -4: string(14 ) "-2,147,480 ,000"
285
+ ... with decimal places of -5: string(14 ) "-2,147,500 ,000"
0 commit comments