note 100199 deleted from function.ini-get by danbrown

From: Date: Thu, 30 Sep 2010 15:15:33 +0000
Subject: note 100199 deleted from function.ini-get by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172850@lists.php.net to get a copy of this message
Note Submitter: Scott Lowe ---- Further to Stas Trefilov's faster return_bytes function, we should typecast as integer for the default case also. This is because 975.36 or 975.36B or 975.36bytes should be interpreted by PHP as 975 bytes. <?php function return_bytes ($size_str) { switch (substr ($size_str, -1)) { case 'M': case 'm': return (int)$size_str * 1048576; case 'K': case 'k': return (int)$size_str * 1024; case 'G': case 'g': return (int)$size_str * 1073741824; default: return (int)$size_str; } } ?>

« previous php.notes (#172850) next »