I have searched high and low to find an answer, but can't seem to find one anywhere.
<?php
$f_contents = file("x.txt");
$line = $f_contents[rand(0, count($f_contents) - 1)];
echo($line);
?>
Currently I am getting random results on every page load, but need to return the string only once. I am using Wordpress, so I would preferably like a way to do this only when a page is created.
Any ideas?