lundi 25 décembre 2017

Get 10>15 random lines (php)

How do I generate 10>15 random Lines From text file

lines.txt . (27 lines)

aaaaaa
zzzzzz
eeeeee
rrrrrr
tttttt
yyyyyy
uuuuuu
iiiiii
oooooo
pppppp
qqqqqq
ssssss
dddddd
ffffff
gggggg
hhhhhh
jjjjjj
kkkkkk
llllll
mmmmmm
ùùùùùù
wwwwww
xxxxxx
cccccc
vvvvvv
bbbbbb
nnnnnn

Random.php

<?php 
$lines = file("lines.txt"); 
shuffle($lines); 
echo implode('|', $lines);
?>

I want like this :

10 lines The Random Result : 10

jjjjjj|dddddd|oooooo|iiiiii|hhhhhh|gggggg|yyyyyy|zzzzzz|tttttt|ùùùùùù

11 lines The Random Result : 11

wwwwww|nnnnnn|llllll|jjjjjj|aaaaaa|oooooo|yyyyyy|qqqqqq|zzzzzz|gggggg|kkkkkk

15 lines The Random Result : 15

eeeeee|aaaaaa|rrrrrr|kkkkkk|ùùùùùù|pppppp|ssssss|bbbbbb|tttttt|zzzzzz|llllll|vvvvvv|cccccc|wwwwww|mmmmmm




Aucun commentaire:

Enregistrer un commentaire