You are here

function simplenews_statistics_encoder_base_encode in Simplenews Statistics 7

Same name and namespace in other branches
  1. 7.2 simplenews_statistics_encoder/encoder.inc \simplenews_statistics_encoder_base_encode()

Convert $var from (10) base notation to $base base notation.

1 call to simplenews_statistics_encoder_base_encode()
simplenews_statistics_encoder_encode in simplenews_statistics_encoder/encoder.inc

File

simplenews_statistics_encoder/encoder.inc, line 22
Encoder for IDs. Some logic borrowed from shorturl module.

Code

function simplenews_statistics_encoder_base_encode($var, $base) {
  if ($var < $base) {
    return $var;
  }
  else {
    return simplenews_statistics_encoder_base_encode(floor($var / $base), $base) . "-" . $var % $base;
  }
}