Find Jobs
Hire Freelancers

Coding a permutation functions : ID into a 6 chars string in PHP (quick work)

€8-30 EUR

Completed
Posted over 6 years ago

€8-30 EUR

Paid on delivery
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.
Project ID: 14657418

About the project

12 proposals
Remote project
Active 7 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello! I will glad to work with You. I do not have feedback, so I work for food)) I think that your calculations are false and can not be built on such rules. I propose to develop other rules. Relevant Skills and Experience I have specialist degree in mathematics. Proposed Milestones €8 EUR - finished project
€8 EUR in 1 day
5.0 (1 review)
0.0
0.0
12 freelancers are bidding on average €21 EUR for this job
User Avatar
Stay tuned, I'm is still working on this proposal.
€29 EUR in 1 day
4.9 (96 reviews)
6.3
6.3
User Avatar
can to do it , write me . Relevant Skills and Experience php Proposed Milestones €23 EUR - for all
€23 EUR in 1 day
5.0 (13 reviews)
3.7
3.7
User Avatar
A proposal has not yet been provided
€19 EUR in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Hi, there. It is easy for me. Relevant Skills and Experience PHP, Laravel, Prgramming Proposed Milestones €20 EUR - As progressing
€20 EUR in 0 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of FRANCE
Tours, France
5.0
15
Payment method verified
Member since Mar 18, 2011

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.