How to separate sets of numbers onto separate lines
- by Fred
About the script:
The script below will create 300 sets of random characters.
What is presently happening, is that it creates them but shows them all on one line, in one big chunk.
With all the searching and testing I've done to try and achieve this, I have had no success.
I would like to know which code and where to put it, so that each SET (300) of 15 characters long, will show and be saved to file.
Here is my script:
<?php
function GetID($x){
$characters = array_merge(range('A','Z'),range('a','z'),range(2,9));
shuffle($characters);
for($x=0;$x<=299;$x++){
}
for (; strlen($ReqID)<$x;){
$ReqID .= $characters[mt_rand(0, count($characters))];
}
return $ReqID;
}
$ReqID .= GetID(5);
$ReqID .= "-";
$ReqID .= GetID(5);
$ReqID .= "-";
$ReqID .= GetID(5);
echo $ReqID;
$fh = fopen("file.txt","a+");
fwrite($fh, ("$ReqID")."\n");
fclose($fh);
?>