generating a code by using sprintf in PHP
<p>I want to generate a serial key with this pattern : </p>

<pre><code>DA-7470-20762
</code></pre>

<p>and this is what I have done so far :</p>

<pre><code>$code = strtoupper(md5(uniqid(microtime(true), true)));
$uuid = sprintf("%02s-%04o-%04o",
    $code[0].$code[1],
    $code[2].$code[3].$code[4].$code[5],
    $code[6].$code[7].$code[8].$code[9]
);
</code></pre>

<p>But I want to prevent serial keys like this :</p>

<pre><code>AB-0000-0001
</code></pre>

<p>I need to remove all 0's, because they are so predictive.</p>

<p>Is there a way to set range for octal sprintf like <code>[1-9]</code>?</p>
