Cancelled

Coding a permutation functions : ID into a 6 chars string in PHP

For a project of mine coded in PHP with Laravel, I'm having a customer table in my database. This table has an ID with auto-increment.

I'm trying to code a function to transform that ID into a string following specific rules :

- The size of the string is 6 caracters maximum

- Caracters in the string are part of [0-9a-v]

- This is the : The "Extended Hex" Base 32 Alphabet

- No maj in the letters

- the letters will be incremented from left

- the numbers will be incremented from right

When I'm inserting a new customer into the database, I should call a function that will transform the ID just generated into a specific string. Here is an example with on the left, the string it should be transformed into, and on the right the ID in the database :

000001 = 0 000 001

999999 = 0 999 999

a00000 = 1 000 000

a00001 = 1 000 001

a10000 = 1 010 000

a99999 = 1 099 999

b00000 = 1 100 000

b99999 = 1 199 999

c00000 = 1 200 000

d00000 = 1 300 000

e00000 = 1 400 000

f00000 = 1 500 000

g00000 = 1 600 000

h00000 = 1 700 000

i00000 = 1 800 000

j00000 = 1 900 000

k00000 = 2 000 000

v00000 = 3 200 000

v99999 = 3 999 999

aa0000 = 4 000 000

aa0001 = 4 000 001

ab0000 = 4 010 000

ac0000 = 4 020 000

ad0000 = 4 030 000

ae0000 = 4 040 000

af0000 = 4 050 000

ag0000 = 4 060 000

ah0000 = 4 070 000

ai0000 = 4 080 000

aj0000 = 4 090 000

ak0000 = 4 100 000

av0000 = 4 200 000

av9999 = 4 209 999

ba0000 = 4 210 000

...

vvvvvv = Number maximum of possible permutations so : 652 458 240

<!> : Maybe I did some mistakes in my calculations.

I need someone to code my that function because I'm totally blocking.

The function should be provided like this :

/**

* Generate identifier associated to the ID of the customer

*

* @param <int> $customerID The customer id

*

* @return <string> $identifier The identifier associated to the customer

*/

function generateCustomerIdentifier($customerID)

Examples :

generateCustomerIdentifier(1) should return : 000001

generateCustomerIdentifier(999999) should return : 999999

generateCustomerIdentifier(1000000) should return : a00000

generateCustomerIdentifier(652458240) should return : vvvvvv

I need this ASAP.

Skills: Algorithm, Mathematics, MySQL, PHP

See more: software write mq4, software write chip epson, useful software write book, software write web specs, free software write user guide, software write edid, free software write company profile, search pdf string php, compress really string php, string php compare past project, software write websites idea, count numbers chars string mips code, find phone number string php, extract phone number string php, read pdf string php, software write book images, php nusoap list functions, software write books, php mysql sample project coding, php zip code functions

About the Employer:
( 10 reviews ) Tours, France

Project ID: #14657395

2 freelancers are bidding on average €555 for this job

technoweb7

Greetings, we are a team of 35 developers and 20 designers and each having more than 8 years experience. I would very much happy to work with you on your project and I have already checked detail your requirement and More

€555 EUR in 10 days
(14 Reviews)
5.4
€555 EUR in 10 days
(44 Reviews)
5.4