3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = generate(); echo $array[0]; echo "<br />"; echo $array[1]; echo "<br />"; echo $array[2]; echo "<br />"; echo $array[3]; echo "<br />"; echo $array[4]; // FUNCTION function generate() { $digilist = "0123456789ABCDEFGHJKLMNPQRTUVWXY"; $ip = gethostbyname('keystone.mwbsys.com'); $long = ip2long($ip); $ipenc = md5($long); //now we generate a new random ID number using the substrings of the digitList string above $id = NULL; $id .= substr($digilist, rand(1, 4), 1); //random number ( adjust where 1,4 is lower boundary or 5,9 is higher boundary) $id .= substr($digilist, rand(10, 20), 1); //then a letter $id .= substr($digilist, rand(21, 31), 1); //another letter $id .= substr($digilist, rand(5, 9), 1); //a number ( adjust where 5,9 is higher boundary or 1,4 is lower boundary) $id .= substr($long, rand(1, 9), 1); //and finally another number ( you can adjust this to high or low) // note in $id if start with high-low-high-low or vice versa combination //ok so now we need to generate an MD5 hash of our ID $st = md5('Licensed'); $duration = md5('Lifetime'); $hash = md5($id); //cycle through the hash 16 (length of key) times (in steps of 2 because each hex bytes is 2 digits long) $i = 0; $key = ""; for ($i; $i < 32; $i+=2) { //here we convert the next hex value to an integer and perform a bitwise AND operation against '31' //31 is the highest substring value in our digit list. $nextdigit = hexdec(substr($hash, $i, 2)) & 31; //if 'i' is divisable by 8 (every 4 cycles) then we want to add "-" if ((($i % 8) == 0) && ($i > 0)) { $key .= "-".substr($digilist, $nextdigit,1); } else { $key .= substr($digilist, $nextdigit, 1); } } $array = array($id, $key, $st, $duration, $long); //return return $array; }
based on bvKOe
Output for 7.1.7
1HP9<br />5W5Q-U67P-GYD6-L7M5<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.9, 5.4.30, 7.1.6
4DY5<br />W67E-XY41-7HYD-U38G<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.1.5
3BP7<br />C8FM-3TNV-CXKM-DGMV<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.1.0
1BX8<br />W4MC-BX7J-RR3B-KCCN<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.0.20
1HR8<br />235J-XDWF-H9K8-4M3F<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.0.6
4BV9<br />X6RA-0YEY-EC39-PNFK<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.0.5
1CP5<br />K0UF-63CL-9FX3-8YTX<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.0.4
4BM9<br />HJTW-FQYX-X3RN-A003<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.0.3
1DU6<br />AT0U-2TB9-EPMD-69TT<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.0.2
4JR8<br />LBG6-GWW8-NVME-WQDX<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.0.1
4AT6<br />BH43-P81K-PMA8-PEHK<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 7.0.0
1DW9<br />8GQJ-PH49-6EH7-KQBR<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.28
1AY5<br />G5X0-UQJQ-G22T-0HX7<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.29, 5.6.21
1AM9<br />8J2Q-YF98-89JE-K3WW<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.20
3JM5<br />988C-CXWX-PTL7-HQAL<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.19
2DQ9<br />TGH7-BQRB-LKM5-TV9L<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.18
4LU5<br />R1KX-8T9W-RD73-8BLF<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.17
2AQ9<br />DR5N-KAK7-PLMT-CDYA<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.16
3DM5<br />9RL6-JDAM-KLHE-Q916<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.39, 5.6.15
3EN8<br />A074-7NLL-EU84-YQ0A<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.14
1BY5<br />DEKM-K7BF-8W6C-7F00<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.13
3DR7<br />YG5V-Y1A1-QXCH-38DC<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.12
1GU6<br />YMAN-76KH-70QD-YYYW<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.11
4HU7<br />C7QJ-VBLR-CEM5-62KQ<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.10
4LV9<br />D6L9-KJMP-YER0-KQTX<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.9
2LQ6<br />DMQW-JHXL-PU0W-JUFY<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.8
3GN7<br />BECF-U967-V54D-EYEA<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.6.7
3AX8<br />KP9N-YXX4-F63H-QB97<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.35
3GP7<br />VG0V-E4MJ-2LF0-4WJW<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.34
2LW7<br />6CGH-9KLA-0JV3-D0CT<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.33
4JT6<br />T45E-A0YQ-6TXU-5DC4<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.32
2ER9<br />AHAX-2CBR-8A90-XXY9<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.31
1DU9<br />06U6-0KPB-PL8C-7WL9<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.30
2LR9<br />WED4-33R8-W7PX-Y3LX<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.29
4CQ9<br />AXH7-AUKH-CR79-HGMP<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.28
1HV8<br />21XW-T4VE-827V-0E45<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.27
1LQ9<br />1VNC-9203-05WV-9KW9<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.26
4HY9<br />06L0-QYQH-Q7MB-4LDK<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.25
4CY9<br />9RRU-CCDG-8VG7-B648<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.5.24
3JT6<br />26QQ-CJEM-RGGP-HT4K<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.45
2ET7<br />APJE-T5JN-PMYJ-L854<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.44
3BU8<br />DMH1-K9TD-F8NJ-ARJQ<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.43
1AR9<br />YYHY-NVXA-BP8L-MA09<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.42
3LR9<br />467P-X8K2-7X8T-JWCY<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.41
3LV5<br />61PJ-J8KE-50H5-AQKK<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.40
3LU8<br />9LM3-GBVV-R3M8-NWLK<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.38
4CY7<br />6108-D9UY-ABE0-N4DK<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.37
3JM8<br />PG4A-JP6M-TEMF-UHCG<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.36
1HU5<br />C1W2-EG4L-6GL2-0TPE<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.35
2AR6<br />QRPU-0VXN-1D60-V9LD<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.34
4KQ6<br />LQ3V-8CBV-HHM5-W6QG<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.32
2FX7<br />W1DX-M5L5-0QK1-E63L<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.31
2CU9<br />J8Y0-W6H8-CRCG-V1M5<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.28
3FQ5<br />2KL1-X2Y1-W641-D9XV<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.27
1EN9<br />GFDQ-4BYK-LCPQ-7VPU<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.26
1DT7<br />36KV-RHKM-5DD9-WU4F<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.25
4BY9<br />NELA-1K85-W2BJ-JJ61<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.24
3AW5<br />KTTP-LQRJ-A81V-R5XU<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.23
1AW5<br />JAL4-TJNL-9AK0-U189<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.22
1KW6<br />GX4N-67CQ-CRBW-61F6<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.21
3JT5<br />6HJF-LD16-8JVQ-84CM<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.20
4DX9<br />MV7K-JKA0-QVM3-BXWM<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.19
1AM8<br />JQ7H-DQE4-LHUY-D1BG<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.18
1CY5<br />KEQQ-D92V-7QKR-BA8P<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.17
1JW5<br />V876-MXM9-9AJT-4QEQ<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.16
3BX7<br />1FU6-9P7V-MH6G-C1FD<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.15
3CU9<br />UYW5-REMG-B7YW-C4RF<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.14
2CQ6<br />EK1E-JDUL-E7L2-BQJ9<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.13
4DR9<br />HCRX-5FLH-RY1L-V4RF<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.12
4EX6<br />FB88-9NYY-HRLE-FMMT<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.11
3AP7<br />02UA-74KE-78ED-KT3P<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.10
4BM5<br />9RYL-DTV9-XAGW-46LE<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.8
4LV7<br />1KJR-6AWV-KY8N-A184<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.7
2AN9<br />A06E-0E6C-KJEC-3FBB<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.6
1LP5<br />BP2V-HFPA-N1GU-9CPB<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.5
4BW8<br />N3ML-HUQ2-5EEN-3PAK<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.4
4AY6<br />LJA9-E00G-PNPM-U73B<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.3
3CW9<br />N1MC-LX29-UDHE-2Y4B<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.2
3BY8<br />LCC1-1PB7-WJG7-YJF3<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.1
3HQ6<br />3MYK-1YN7-W18H-PLC8<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.4.0
3AQ9<br />DVDQ-HMDD-BMQD-2331<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.25, 5.3.29
4CP9<br />HLCT-Y0RA-P3D7-YQR3<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.28
4EU9<br />ECGN-F6XB-8R5M-VB8W<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.27
1KM8<br />AGM2-J0MP-XC9U-9BYK<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.26
4FQ7<br />F1HX-XMQK-YY80-26AX<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.24
4CX5<br />5U0G-K2AW-YAD5-315H<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.23
1BV8<br />JEC9-1FJ6-4EMH-DGTT<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.22
1KX6<br />GAPK-JYY0-LBK3-UULE<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.21
1AQ6<br />TJJU-4QJ3-HXKD-7RT0<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.20
2FV7<br />URRQ-1AD5-2Q77-9B7J<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />
Output for 5.3.19
2LW8<br />GEJ9-HDAK-5XL4-V1UF<br />82e3d407504f0d6040bbcb3cf5e0cee8<br />1a10be3692cec335c74387f33221a6fa<br />