Changeset 487 for trunk/lib/Utilities.inc.php
- Timestamp:
- Aug 20, 2014 11:56:27 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r486 r487 503 503 } 504 504 505 /* 506 * Convert a php.ini value (8M, 512K, etc), into integer value of bytes. 507 * 508 * @access public 509 * @param string $val Value from php config, e.g., upload_max_filesize. 510 * @return int Value converted to bytes as an integer. 511 * @author Quinn Comendant <quinn@strangecode.com> 512 * @version 1.0 513 * @since 20 Aug 2014 14:32:41 514 */ 515 function phpIniGetBytes($val) 516 { 517 $val = trim(ini_get($val)); 518 if ($val != '') { 519 $last = strtolower($val{strlen($val) - 1}); 520 } else { 521 $last = ''; 522 } 523 switch ($last) { 524 // The 'G' modifier is available since PHP 5.1.0 525 case 'g': 526 $val *= 1024; 527 case 'm': 528 $val *= 1024; 529 case 'k': 530 $val *= 1024; 531 } 532 533 return (int)$val; 534 } 535 505 536 /** 506 537 * Tests the existence of a file anywhere in the include path.
Note: See TracChangeset
for help on using the changeset viewer.