int2vancode

  1. drupal
    1. 4.7
    2. 5 comment.module
    3. 6 comment.module
    4. 7 comment.module
Versions
4.7 – 7 int2vancode($i = 0)

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 functions call int2vancode()

comment_save in modules/comment.module
Accepts a submission of new or changed comment content.
system_update_172 in database/updates.inc

Code

modules/comment.module, line 1787

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