Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Format a number with grouped thousands
<?php number_format( float $num, int $decimals = 0, ?string $decimal_separator = ".", ?string $thousands_separator = ","): string
<?php $seeder->__invoke($parameters);
if ($silent === false && isset($this->command)) {
$runTime = number_format((microtime(true) - $startTime) * 1000);
with(new TwoColumnDetail($this->command->getOutput()))->render(
$name,
<?php public static function dd(Closure|array $benchmarkables, int $iterations = 1): void
{
$result = collect(static::measure(Arr::wrap($benchmarkables), $iterations))
->map(fn ($average) => number_format($average, 3).'ms')
->when($benchmarkables instanceof Closure, fn ($c) => $c->first(), fn ($c) => $c->all());
dd($result);
<?php return $runTime > 1000
? CarbonInterval::milliseconds($runTime)->cascade()->forHumans(short: true)
: number_format($runTime, 2).'ms';
}
}
<?php if ($exitCode === 1) {
$this->output->writeln(sprintf(
"\n <fg=white;bg=red;options=bold> FAIL </> Code coverage below expected <fg=white;options=bold> %s %%</>, currently <fg=red;options=bold> %s %%</>.",
number_format($this->coverageMin, 1),
number_format($coverage, 1)
));
}
<?php $this->output->writeln(sprintf(
"\n <fg=white;bg=red;options=bold> FAIL </> Code coverage below expected <fg=white;options=bold> %s %%</>, currently <fg=red;options=bold> %s %%</>.",
number_format($this->coverageMin, 1),
number_format($coverage, 1)
));
}
<?php $percentage = $file->numberOfExecutableLines() === 0
? '100.0'
: number_format($file->percentageOfExecutedLines()->asFloat(), 1, '.', '');
$uncoveredLines = '';
<?php $totalCoverageAsString = $totalCoverage->asFloat() === 0.0
? '0.0'
: number_format($totalCoverage->asFloat(), 1, '.', '');
renderUsing($output);
render(<<<HTML
<?php $terminalWidth = $this->getTerminalWidth();
$url = parse_url($request['url'], PHP_URL_PATH) ?: '/';
$duration = number_format(round($request['duration'], 2), 2, '.', '');
$memory = isset($request['memory'])
? (number_format($request['memory'] / 1024 / 1204, 2, '.', '').' mb ')
<?php $duration = number_format(round($request['duration'], 2), 2, '.', '');
$memory = isset($request['memory'])
? (number_format($request['memory'] / 1024 / 1204, 2, '.', '').' mb ')
: '';
['method' => $method, 'statusCode' => $statusCode] = $request;
<?php protected function sizeKilobytes()
{
return (float) number_format($this->sizeBytes() / 1024, 2);
}
protected function sizeKb()
<?php protected function sizeMegabytes()
{
return (float) number_format($this->sizeBytes() / 1048576, 2);
}
protected function sizeMb()
<?php protected function sizeGigabytes()
{
return (float) number_format($this->sizeBytes() / 1073741824, 2);
}
protected function sizeGb()
<?php return $submission->get($field);
});
return number_format($value, $this->get('precision', 2));
}
}
<?php $number = floatval(str_replace(',', '', $value));
return number_format($number, $precision, $dec_point, $thousands_sep);
}
<?php $pathinfo = pathinfo($path);
$size = File::size($path);
$kb = number_format($size / 1024, 2);
$mb = number_format($size / 1048576, 2);
$gb = number_format($size / 1073741824, 2);