Jump to content

Recommended Posts

Hey dudez and dudettes, im working on this little fun project where instead of people mailing back RSVP's from my invitations they will also have the option to RSVP via a website.

 

So each invitation will have a code A1B2C3 which the user will input and the site will automatically know who that person is and the amount of people on that invitation.

 

I really dont feel like randomly crating the 5 character codes myself and figured it would be more usefull for me to learn how to do it the php way hehe...

 

So basically i want to run a script that will create lets say 100  five character alphanumeric codes all caps plz. That look like F9M3C1.

 

Thank You all who help.

Link to comment
https://forums.phpfreaks.com/topic/115233-solved-create-random-alphanumeric-code/
Share on other sites

That solution will only give you letters in the range of 'A' to 'F', the following solution uses the whole alphabet:

<?php
$a = array_merge(range(0,9),range('A','Z'));
shuffle($a);
echo implode('',array_slice($a,0,5));
?>

 

Ken

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.