PHP Random String Generator, Random Value from Array


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.

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:


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

PHP Random String Generator, Random Value from Array
5 - 1191 votes

Other Posts you may be interested in:

  1. Đêm Buồn Tỉnh Lẻ – HD Karaoke
  2. Hosting – Namecheap shared hosting
  3. Ất Mùi 2015 – việc nên làm và không nên làm
  4. PHP Random Quotes – Random Text script
  5. How to restore Windows 8 – Windows 8.1 by System Restore
  6. Lịch thi đấu ngoại hạng Anh mùa giải 2015-2016
  7. Bộ hình nền máy tính Bikini chất lượng Full HD 1920×1080
Cập nhật lúc: 15:49:40 PM, 9th September 2014


Leave A Reply