forked from tilderadio/site
added slogans
This commit is contained in:
parent
b83368174a
commit
4d12281933
16
index.php
16
index.php
|
@ -1,6 +1,22 @@
|
||||||
<?php include 'header.php'; ?>
|
<?php include 'header.php'; ?>
|
||||||
|
|
||||||
<h1><a href="https://tilderadio.org"><img style="width:75px;" src="./logos/tilderadio-green.png">tilderadio.org</a></h1>
|
<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>
|
||||||
<br>
|
<br>
|
||||||
|
|
Loading…
Reference in New Issue