I would like to create a .php file that will read a .txt file and then for each line in the text file it will take the data and create a new link with the data.
Example:
list.txt
r2389
y3323
u3330
d2723
reader.php
<?php
$myFile = "list.txt";
$lines = file($myFile);
?>
<a href="http://website.com/<?php echo $lines[0];?>">link 1</a>
<a href="http://website.com/<?php echo $lines[1];?>">link 2</a>
<a href="http://website.com/<?php echo $lines[2];?>">link 3</a>
<a href="http://website.com/<?php echo $lines[3];?>">link 4</a>
reader.php output
<a href="http://website.com/r2389">link 1</a>
<a href="http://website.com/y3323">link 2</a>
<a href="http://website.com/u3330">link 3</a>
<a href="http://website.com/d2723">link 4</a>
This will get the information and then echo it into the link.
But this means I need to create the right amount of links for it to work properly, in the end I want to just be able to edit the list.txt and then have the php automatically create a
<a href="<?php echo $lines[*];?>">link *</a>
depending on the amount of lines in the list.txt. It will also label
<a>link *</a>
depending on the line number.
Thanks in advance.