Jump to content

Recommended Posts

<?php

$f="F";

 

$Cnt=99; //<-- id, value from DB

 

//range of ascii,

//A:0-99, B:100-199, C:200-299, ..Z:2600-2699

 

$asciiPrefix = (int)65;

$asciiPrefix += (int)($Cnt/100);

$Cnt++;

 

$newValue =$f. chr($asciiPrefix).''.((int)$Cnt%100);

 

echo $newValue;

?>

 

 

 

from above code i ll get output on cnt=0 =FA1 Cnt=1=FA2.....CNT=99=A0 but i dont wanna dis like....i wanted an output like dis cnt=1=FA1 Cnt=2=FA2 ....Cnt 99=FA99 and when cnt  reaches100 it will be like Cnt=100=FB1....Cnt=198=FB99......Cnt=199=FC1 Cnt=297=FC99 an so on....so guys please give me a solution how to put range A=1 to 99 den B=100 to 198 ....c=199 to 297 and z=2476 to 2574

18716_.php

$f="F";
$range = 99;
$letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

for($Cnt=1; $Cnt<400; $Cnt++)
{
    $cntIndex = floor(($Cnt-1) / $range);
    $newValue = $f . $letters[$cntIndex] .($Cnt - ($cntIndex * $range));
    echo "{$Cnt} : {$newValue}<br>\n";
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.