Created
April 14, 2013 12:59
-
-
Save irazasyed/5382635 to your computer and use it in GitHub Desktop.
PHP: Get random line from file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*-------------------------------------------------+ | |
| Get random line from file | |
+-------------------------------------------------*/ | |
function getRandomLine($filename) { | |
$lines = file($filename) ; | |
return $lines[array_rand($lines)] ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment