note 72637 added to function.ini-get
| From: | vgr at europeanexperts dot org | Date: | Sat, 27 Jan 2007 07:23:08 +0000 |
| Subject: | note 72637 added to function.ini-get | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122257@lists.php.net to get a copy of this message | ||
for rui.pires :
please consider that the suggested sample code above is by far more accurate and faster than yours
;-)
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
is faster and more logical than three slow regexp calls
1K = 1024 in IT and not 1000 (k = kilo in ISO system) - note the different case for the symbols so
thay can not be mistaken. You can not mistake "MW" (mega Watt = 1000*1000 Watt) with
"MB" (1024*1024 byte)
1M = 1024*1024 in IT and not 1'000'000 (M = Mega in ISO system) - symbols are the same
except the first applies only to 'B' or 'o' (bytes, octets, 8 bits) like in
"MB", "Ko", rarely to "machine words" (w, undefined number of bits)
Idem for Giga
----
Server IP: 195.221.21.36
Probable Submitter: 82.243.20.181
----
Manual Page -- http://www.php.net/manual/en/function.ini-get.php
Edit -- https://master.php.net/note/edit/72637
Del: integrated -- https://master.php.net/note/delete/72637/integrated
Del: useless -- https://master.php.net/note/delete/72637/useless
Del: bad code -- https://master.php.net/note/delete/72637/bad+code
Del: spam -- https://master.php.net/note/delete/72637/spam
Del: non-english -- https://master.php.net/note/delete/72637/non-english
Del: in docs -- https://master.php.net/note/delete/72637/in+docs
Del: other reasons-- https://master.php.net/note/delete/72637
Reject -- https://master.php.net/note/reject/72637
Search -- https://master.php.net/manage/user-notes.php