0
Anyone knows how to display random words up to a random word in php?
3 Answers
+ 4
No, if you copy/paste this codes, it does the work.
The line which Split in an array is the following line ("//..." indicate that it is a comment) :
$tabword = explode ( ' ', $words).
+ 3
<?php
$words = "this is the life";
// Split in an array
$tabword = explode(' ',$words);
// Mix it
shuffle($tabword);
// Display
foreach ($tabword as $word){
print ($word." ");
}
?>
0
thank you, but can you please explain if I have to add anything else where you say to split it in an array, because I'm a beginner still?