You are here

function int2vancode in Drupal 5

Same name and namespace in other branches
  1. 4 modules/comment.module \int2vancode()
  2. 6 modules/comment/comment.module \int2vancode()
  3. 7 modules/comment/comment.module \int2vancode()

Generate vancode.

Consists of a leading character indicating length, followed by N digits with a numerical value in base 36. Vancodes can be sorted as strings without messing up numerical order.

It goes: 00, 01, 02, ..., 0y, 0z, 110, 111, ... , 1zy, 1zz, 2100, 2101, ..., 2zzy, 2zzz, 31000, 31001, ...

2 calls to int2vancode()
comment_save in modules/comment/comment.module
Accepts a submission of new or changed comment content.
system_update_172 in modules/system/system.install

File

modules/comment/comment.module, line 2012
Enables users to comment on published content.

Code

function int2vancode($i = 0) {
  $num = base_convert((int) $i, 10, 36);
  $length = strlen($num);
  return chr($length + ord('0') - 1) . $num;
}