Simplify line extraction
This commit is contained in:
parent
3ce2b0a43a
commit
935f20c019
1 changed files with 5 additions and 4 deletions
|
|
@ -6,10 +6,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
header('Content-Type: text/plain');
|
header('Content-Type: text/plain');
|
||||||
if ($s = file_get_contents(__DIR__ . '/flachwitze.txt')) {
|
if ($f = file(__DIR__ . '/flachwitze.txt')) {
|
||||||
$a = explode("\n", $s);
|
if (($c = count($f)) > 1) {
|
||||||
if (($c = count($a)) > 1)
|
$r = mt_rand(0, $c - 1);
|
||||||
echo $a[mt_rand(0, $c - 1)] . "\n";
|
echo $f[$r];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue