note 72637 deleted from function.ini-get by nlopess

From: Date: Sat, 27 Jan 2007 20:20:14 +0000
Subject: note 72637 deleted from function.ini-get by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-122278@lists.php.net to get a copy of this message
Note Submitter: vgr at europeanexperts dot org ---- 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

« previous php.notes (#122278) next »