title: What is an alternative to php function bcpow?
body: <p>I'm using this guide - <a href="http://kevin.vanzonneveld.net/techblog/article/create_short_ids_with_php_like_youtube_or_tinyurl/" rel="nofollow">http://kevin.vanzonneveld.net/techblog/article/create_short_ids_with_php_like_youtube_or_tinyurl/</a></p>
  
  <p>to generate short codes for URL.</p>
  
  <p>But bcpow() isn't working anyhow on my system.</p>
  
  <p>I'm using php-cli and phpinfo(); shows bcmath is installed.</p>
  
  <p>Numeric to shortcode -</p>
  
  <pre><code>function aplhaIdCalc( $in ) {
      $index = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";        
      $base = 62;
      $out = "";
      for ($t = floor(log($in, $base)); $t &gt;= 0; $t--) {
        $bcp = bcpow($base, $t);
        $a   = floor($in / $bcp) % $base;
        $out = $out . substr($index, $a, 1);
        $in  = $in - ($a * $bcp);
      }
      $out = strrev($out); // reverse
      return $out;
  }
  </code></pre>
  
  <p>Shortcode to numeric -</p>
  
  <pre><code>function idAlphaCalc( $in ) {
      $index = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";        
      $base = 62;
      $in  = strrev($in);
      $out = 0;
      $len = strlen($in) - 1;
      for ($t = 0; $t &lt;= $len; $t++) {
        $bcpow = bcpow($base, $len - $t);
        $out   = $out + strpos($index, substr($in, $t, 1)) * $bcpow;
      }
      $out = sprintf('%F', $out);
      $out = substr($out, 0, strpos($out, '.'));
      return $out;
  }
  </code></pre>
  
  <p>How can I use these functions without bcpow and yet get similar output and input?</p>
  
  <p>I can't understand these BCMath functions but I think base_convert might work.</p>
  
  <p>Edit : Changing <code>bcpow</code> to <code>pow</code> works. What are the risks involved in using <code>pow</code> ?</p>