The function formats an integer with grouped thousands and optionally +/− signs.
Install via Composer:
$ composer require sergeyakovlev/int-format
use function SergeYakovlev\IntFormat\int_format;
$value = -1000000;
// Use cases are equivalent
$formatted_value = int_format($value);
$formatted_value = int_format($value, ' ', '', '−');
// $formatted_value = "−1 000 000"