Search
 
SCRIPT & CODE EXAMPLE
 

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)];
Comment

PREVIOUS NEXT
Code Example
Php :: symfony password 
Php :: php round() function 
Php :: php month single digit 
Php :: Type error: Argument 1 passed to IlluminateAuthEloquentUserProvider::validateCredentials() 
Php :: php artisan storage link cpanel 
Php :: php get ip from host 
Php :: laravel make model with migration 
Php :: php exercises and solutions 
Php :: laravel-socialite-invalidstateexception 
Php :: how to save file in storage folder in laravel 
Php :: php connection mysqli database 
Php :: wordpress thumbnail 
Php :: separate date from datetime php 
Php :: get full current url in laravel 
Php :: php mongodb version cmd 
Php :: laravel form in 24 hours format 
Php :: laravel hasmany count 
Php :: column of csv to array php 
Php :: php counter 
Php :: ::update() should not be called statically 
Php :: current url wordpress 
Php :: self submit form php 
Php :: Flutter migrate to Android Studio 
Php :: iteration in php 
Php :: laravel make view 
Php :: get taxonomy term meta by id 
Php :: laravel update by id 
Php :: laravel ckeditor 
Php :: cakephp 2.x join 
Php :: laravel foreach loop 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =