Skip to content

Commit

Permalink
Merge pull request #14 from PierreRambaud/fix/toBytes
Browse files Browse the repository at this point in the history
Fix toBytes method
  • Loading branch information
PierreRambaud committed Aug 13, 2020
2 parents de0f3f3 + acb7a96 commit 6bc03d4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions phppsinfo.php
Expand Up @@ -354,17 +354,19 @@ public function getServerModules()
* Convert PHP variable (G/M/K) to bytes
* Source: http://php.net/manual/fr/function.ini-get.php
*
* @param mixed $value
*
* @return integer
*/
public function toBytes($val)
public function toBytes($value)
{
if (is_numeric($val)) {
return $val;
if (is_numeric($value)) {
return $value;
}

$val = trim($val);
$val = (int) $val;
switch (strtolower($val[strlen($val)-1])) {
$value = trim($value);
$val = (int) $value;
switch (strtolower($value[strlen($value)-1])) {
case 'g':
$val *= 1024;
// continue
Expand Down

0 comments on commit 6bc03d4

Please sign in to comment.