Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Can someone create a 3 second script and show me how it works?


Mb0742's Avatar
Ultimate Headshot
0 0

Ok,

I need a .php script that randomly generates 4digits in a row 9times with a dash in between each 4 digit set. The digits must be random and from a-z from 1-9 for any one of the chars in every set.

Then I just need it to output the value please give me a hand this is something I need to know.

EDIT: 1111-2222-3333-4444-5555-6666-7777-8888-9999 style.


richohealey's Avatar
Python Ninja
0 0

why do you need this again?


Mb0742's Avatar
Ultimate Headshot
0 0

personal project ;)


Mb0742's Avatar
Ultimate Headshot
0 0

<?php function get_rand_id(36) { if($length>0) { $rand_id=""; for($i=1; $i<=$length; $i++) { mt_srand((double)microtime() * 1000000); $num = mt_rand(1,36); $rand_id .= assign_rand_value($num); } } return $rand_id; } ?>

Here is the script now what should I echo to print it out?


ghost's Avatar
0 0

People generally are not going to write scripts for you…

however this interested me (slightly) so i wrote a script (2.5 mins)

&lt;?php
srand(time());
$options[0] = &quot;a&quot;;
$options[1] = &quot;b&quot;;
$options[2] = &quot;c&quot;;
$options[3] = &quot;d&quot;;
$options[4] = &quot;e&quot;;
$options[5] = &quot;1&quot;;
$options[6] = &quot;2&quot;;
$options[7] = &quot;3&quot;;
$options[8] = &quot;4&quot;;
$count = count($options);
echo &quot;&lt;br /&gt;&quot;;
$sect=0;
$unit=0;
$string=&quot;&quot;;
while ($sect&lt;10){
while ($unit&lt;4){
$random = (rand()%$count);
$string.=$options[$random];
$unit+=1;
}
$string.=&quot;-&quot;;
$unit=0;
$sect+=1;
}
echo &quot;Your id code is: &quot;.$string;
?&gt;