added slogans

This commit is contained in:
deepend 2020-06-21 01:43:00 -06:00
parent b83368174a
commit 4d12281933
1 changed files with 16 additions and 0 deletions

View File

@ -1,6 +1,22 @@
<?php include 'header.php'; ?>
<h1><a href="https://tilderadio.org"><img style="width:75px;" src="./logos/tilderadio-green.png">tilderadio.org</a></h1>
<h4>
<?php
$file = "slogans.txt";
// Convert the text fle into array and get text of each line in each array index
$file_arr = file($file);
// Total number of linesin file
$num_lines = count($file_arr);
// Getting the last array index number by subtracting 1 as the array index starts from 0
$last_arr_index = $num_lines - 1;
// Random index number
$rand_index = rand(0, $last_arr_index);
// random text from a line. The line will be a random number within the indexes of the array
$rand_text = $file_arr[$rand_index];
echo $rand_text;
?>
</h4>
<br>
<br>