Skip to main content

php_number_format 1.0.0 copy "php_number_format: ^1.0.0" to clipboard
php_number_format: ^1.0.0 copied to clipboard

PHP's number_format($x, 2) reproduced exactly in Dart, so a Flutter app shows the same money value as its PHP or Laravel backend.

example/example.dart

import 'package:php_number_format/php_number_format.dart';

void main() {
  // The same values the Laravel web page prints with number_format($x, 2).
  print(phpNumberFormat2(17.145)); // 17.15 (a plain Dart round gives 17.14)
  print(phpNumberFormat2(1234567.895)); // 1,234,567.90
  print(phpNumberFormat2(-0.004)); // 0.00
}
0
likes
160
points
576
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

PHP's number_format($x, 2) reproduced exactly in Dart, so a Flutter app shows the same money value as its PHP or Laravel backend.

Repository (GitHub)
View/report issues

Topics

#php #formatting #currency #rounding #laravel

License

MIT (license)

More

Packages that depend on php_number_format