Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

random word using a wordlist php

// Read the whole file into a array.
$file = file('File Location');

// Getting the Words Count in the file.
$wCount = count($file);

// Printing out the random word.
echo $file[rand(0, $wCount - 1)];

// This is a one liner.
echo file('File Location')[rand(0, count(file('File Location')) - 1)];
 
PREVIOUS NEXT
Tagged: #random #word #wordlist #php
ADD COMMENT
Topic
Name
7+4 =