note 117041 deleted from function.sprintf by tularis
| From: | tularis@php.net | Date: | Mon, 06 Apr 2015 22:05:07 +0000 |
| Subject: | note 117041 deleted from function.sprintf by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-202188@lists.php.net to get a copy of this message | ||
Note Submitter: cottton at i-stats dot net
----
"An optional precision specifier in the form of a period (`.') followed by ..."
if you also thought:
<?php
echo sprintf("%`.'0f", $n); // hu? oO?
?>
=)
use it like: "%.0f" or "%.2f"
<?php
$n = 111111111111111;
echo sprintf("%.0f", $n); // 111111111111111.000000
echo sprintf("%.0f", $n); // 111111111111111
echo sprintf("%.1f", $n); // 111111111111111.0
?>