001, 002, 003, ..., 009, 0A0, 0A1, etc....
And I have no idea how to do it.
Please help!
Moderator: General Moderators
Code: Select all
for( $i = 1; $i <= 50; $i++ )
{
print str_pad( dechex( $i ), 3, "0", STR_PAD_LEFT) . "<br />";
}It might help if we knew what you are trying to do. Is it going to be used as a record identifier in a database table?elliebee wrote:Hi guys. I'm hoping you could help me out. I need to generate some ID that is alphanumeric.. Something like
001, 002, 003, ..., 009, 0A0, 0A1, etc....
And I have no idea how to do it.![]()
Please help!
deadoralive wrote:You after something like this?
Output:Code: Select all
for( $i = 1; $i <= 50; $i++ ) { print str_pad( dechex( $i ), 3, "0", STR_PAD_LEFT) . "<br />"; }
001, 002, 003, 004, 005, 006, 007, 008, 009, 00a, 00b, 00c, 00d, 00e, 00f, 010, 011, 012, 013, 014, 015, 016, 017, 018, 019, 01a, 01b,
01c, 01d, 01e, 01f......