|
|
|
> Suppose X = 7394; and you'd like to compute how many megabytes X
>evaluates. You'd probably use X / 1024 which will yield: 7.220703125.
>
> Question is: how can you limit the digits after the period, lets say 3
>digits, so the above answer would be: 7.220 = 7.22.
$M = (float) sprintf("%.2f",$X/1024);
(the float casting is not really necessary).
|
|
| Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | How to access MS Excel spread sheets from PHP Categories : PHP, Excel, ODBC, Databases | | | Password reminder Categories : PHP, PHP Classes, Databases, MySQL, Mail | | | Website Engine Categories : PHP, HTML and PHP, Templates | | | How to strip non-alpha characters from a string Categories : Regexps, PHP | | | PHP Nested Menu Example - Shows how to make a single level nested menu Categories : PHP, Navigation | | | ovrimos_close -- Closes the connection to ovrimos Categories : PHP, PHP Functions, OvrimosSQL | | | Anti SQL injection-PHP Categories : PHP, MySQL, Security | | | Password protection for Phorum 3.1.x with userlevels and log. Categories : PHP, MySQL, Authentication, Security | | | This script allows people to add their favorite quotes to your website. This
could easily be modified to be a guestbook script or comment page script. Categories : PHP, Complete Programs, HTML and PHP, Misc | | | Form Elements Class Categories : PHP, PHP Classes, Form Processing | | | Secure Login Categories : PHP, MySQL, Cookies, Security | | | Audio-Enable Discussion Boards with this Web-page Audio Recorder / Player! Categories : PHP Extensions, Java, PHP | | | Link Submition - Allow your visitors to submit links to the site. Categories : PHP, Arrays, Filesystem, Beginner Guides | | | Produces browser-safe strings while preserving HTML tags. Categories : Strings, HTTP, PHP, HTML and PHP | |
|
|