php - Is there an alternative for file_get_contents? -


i tried getting 1 character file comments.txt

i want random lines 1 one .. file_get_contents disabled urlencode

$f_contents = file_get_contents("comments.txt"); $line = $f_contents[array_rand($f_contents)]; $messages = $line; $messages = urlencode($messages); 

you can simplify ..

<?php $arr = file('comments.txt',file_ignore_new_lines); shuffle($arr); foreach($arr $v) {  echo $v."<br>"; } 

the above code prints random lines text file 1 one.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -