original_string: protected function toBytes($str){
          $val = substr(trim($str), 0, strlen($str)-1);
          $last = strtolower($str[strlen($str)-1]);
          switch($last) {
              case 'g': $val *= 1024;
              case 'm': $val *= 1024;
              case 'k': $val *= 1024;
          }
          return $val;
      }
code: protected function toBytes($str){
          $val = substr(trim($str), 0, strlen($str)-1);
          $last = strtolower($str[strlen($str)-1]);
          switch($last) {
              case 'g': $val *= 1024;
              case 'm': $val *= 1024;
              case 'k': $val *= 1024;
          }
          return $val;
      }
code_tokens: protected function toBytes ( $ str ) { $ val = substr ( trim ( $ str ) , 0 , strlen ( $ str ) - 1 ) ; $ last = strtolower ( $ str [ strlen ( $ str ) - 1 ] ) ; switch ( $ last ) { case 'g' : $ val *= 1024 ; case 'm' : $ val *= 1024 ; case 'k' : $ val *= 1024 ; } return $ val ; }
docstring: Converts a given size with units to bytes.
  @param string $str
docstring_tokens: Converts a given size with units to bytes .