I have 3 words: (book, help, air)
I want these 3 words to be displayed in different modes
Example :
book help air
book air help
help air book
air book help
....
First Set your word as array
$array = ['book', 'help', 'air'];
echo random_string_from_array( $array, 10);
// Function For string from words array randomization
// $array is array of words, $n is number of times of randomization of words
function random_string_from_array( $array, $n)
{
$my_str = '';
for( $i == 1; $i <= $n; $i++ )
{
shuffle($array);
$my_str .= implode(" ",$array);
$my_str .= "<br>";
}
return $my_str;
}
You could use the function: array_rand
https://www.php.net/manual/en/function.array-rand.php
$array = ['book', 'help', 'air'];
echo array_rand($array);