public static function varInfo($var, $type = NULL) {
    if ($var === NULL) return 'NULL';
    
    $type = self::getType($var);
    
    if ($type == 'string') {
      return sprintf(
        'string(%d) "%s"',
        mb_strlen($var),
        (string) $var
      );
    } elseif ($type == 'array') {
      return sprintf('array(%s)', 
        A::implode($var, ', ',function ($item) {
          return Util::varInfo($item);
        })
      );
    } elseif ($var instanceof Info) {
      return $var->getVarInfo();
    } elseif ($var instanceof \stdClass) {
      return '(object) '.json_encode($var);
    } elseif (is_object($var)) {
      return sprintf('%s(%s)', method_exists($var, '__toString') ? $var->__toString() : 'not converted to string', self::typeInfo($var));
    } elseif (is_bool($var)) {
      return sprintf('boolean(%s)',$var ? 'true' : 'false');
    } else {
      return sprintf('%s(%s)', self::typeInfo($var), (string) $var);
    }
  }