note 92009 added to language.types.float
| From: | alex dot dima at gmail dot com | Date: | Sat, 04 Jul 2009 22:57:32 +0000 |
| Subject: | note 92009 added to language.types.float | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-157927@lists.php.net to get a copy of this message | ||
To Bob and kjohnson
To convert a float to a string with a specific format just use *printf. For example:
<?php
$float_value = 1.6E+6;
$string_value = sprintf("%f", $float_value);
// 1600000.000000
$float_value = -4.566e-12;
$string_value = sprintf("%.20f", $float_value);
// -0.00000000000456600000
$float_value = +34e+10;
$string_value = sprintf("%.20f", $float_value);
// 340000000000.00000000000000000000
?>
----
Server IP: 209.41.74.194
Probable Submitter: 79.114.54.148
----
Manual Page -- http://www.php.net/manual/en/language.types.float.php
Edit -- https://master.php.net/note/edit/92009
Del: integrated -- https://master.php.net/note/delete/92009/integrated
Del: useless -- https://master.php.net/note/delete/92009/useless
Del: bad code -- https://master.php.net/note/delete/92009/bad+code
Del: spam -- https://master.php.net/note/delete/92009/spam
Del: non-english -- https://master.php.net/note/delete/92009/non-english
Del: in docs -- https://master.php.net/note/delete/92009/in+docs
Del: other reasons-- https://master.php.net/note/delete/92009
Reject -- https://master.php.net/note/reject/92009
Search -- https://master.php.net/manage/user-notes.php