|
-
Nov 6th, 2005, 03:25 PM
#1
Thread Starter
Hyperactive Member
getting a random item from .txt file
does anyone know how to get a random item from a .txt file in php?
-
Nov 6th, 2005, 06:58 PM
#2
Re: getting a random item from .txt file
how is the text file delimited?
-
Nov 7th, 2005, 01:06 AM
#3
Re: getting a random item from .txt file
And what kind of item do you want to get?
-
Nov 7th, 2005, 07:56 AM
#4
Junior Member
Re: getting a random item from .txt file
look at the fopen() and fgets() functions on php.net
-
Nov 7th, 2005, 10:00 PM
#5
Thread Starter
Hyperactive Member
Re: getting a random item from .txt file
<?
for ($i = 1; $i <= 200; $i++)
{
$textfile ="file.txt";
$items = file("$textfile");
$item = rand(0, sizeof($items)-1);
$numbers[$i] = $items[$item];
}
?>
will this code take 200 RANDOM keywords each time from file.txt? file.txt has over 5000+ words. so what i wanted to do was grab 200 random keywords from that 5000 words each time the page is loaded
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|