In this tutorial, we will creat a random string, get a value from an array. Why do we need it? Simple, sometime, we have license that limit number of query to 90, but we need more, so we register 5 or more licenses, then we use PHP random from array to get 1 license. Or we want to creat a 9 capital, number value for license key (for whom need generate a license key).

Demo: PHP Random String Generator, Random Value from Array

Now, let’s go.
First, we will generate a Random string:

That function will generate a random string with capital character and number. Number of character will define by us.
Example:

Will generate a random string in 15 chracter length, from these character only: ABCDEFGHKLMNPQRSTUVWXYZ123456789
If you need lowercase character, just define it in $chars. Something like this:

Now, how about get a license from an array license?
Let’s try:
We have a licenses list:

Now, we get 1 license key from that array:

Used:

Well, that’s it. Is it simple? :D

Other Posts you may be interested in:

  1. FFSJ 3.3 – Chia nhỏ hoặc nối các files dạng .a, .b, .c hoặc .001, .002, .003
  2. Một số thủ thuật với htaccess Mod Rewrite
  3. Domains – Namecheap domains
  4. Hostgator Blackfriday and Cyber Monday 2014 coupon
  5. Cách cài đặt Ccleaner để dọn rác máy tính – Phần 2
  6. Giảm giá lớn tới 75% tại Hostgator
  7. Nam y chữa nội, ngoại thương sưng tím, bầm dập, do bị đòn, ngã

Last updated on September 9th, 2014 at 03:49 pm

Leave A Reply