Total Complexity | 3 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
7 | class Trunc |
||
8 | { |
||
9 | use ArrayEnabled; |
||
10 | |||
11 | /** |
||
12 | * TRUNC. |
||
13 | * |
||
14 | * Truncates value to the number of fractional digits by number_digits. |
||
15 | * This will probably not be the precise result in the unlikely |
||
16 | * event that the number of digits to the left of the decimal |
||
17 | * plus the number of digits to the right exceeds PHP_FLOAT_DIG |
||
18 | * (or possibly that value minus 1). |
||
19 | * Excel is unlikely to do any better. |
||
20 | * |
||
21 | * @param null|array|float|string $value Or can be an array of values |
||
22 | * @param array|float|int|string $digits Or can be an array of values |
||
23 | * |
||
24 | * @return array|float|string Truncated value, or a string containing an error |
||
25 | * If an array of numbers is passed as an argument, then the returned result will also be an array |
||
26 | * with the same dimensions |
||
27 | */ |
||
28 | public static function evaluate(array|float|string|null $value = 0, array|float|int|string $digits = 0): array|float|string |
||
37 |