You are here

function _emaillog_get_variable_size in Logging and alerts 8

Same name and namespace in other branches
  1. 6.2 emaillog/emaillog.module \_emaillog_get_variable_size()
  2. 7.2 emaillog/emaillog.module \_emaillog_get_variable_size()
  3. 2.0.x emaillog/emaillog.module \_emaillog_get_variable_size()

Returns size of a variable.

1 call to _emaillog_get_variable_size()
emaillog_emaillog_debug_info_alter in emaillog/emaillog.module
Replaces backtrace argument values with their types.

File

emaillog/emaillog.module, line 198
Drupal Module: Email Logging and Alerts.

Code

function _emaillog_get_variable_size($variable) {
  switch (gettype($variable)) {
    case 'array':
    case 'object':
      return count((array) $variable);
    case 'integer':
    case 'int':
    case 'boolean':
    case 'bool':
    case 'float':
    case 'double':
    case 'real':
    case 'string':
      return strlen((string) $variable);
    default:
      return '?';
  }
}