Jump to content

Turning a .txt file into an array


mstevens

Recommended Posts

I am trying to turn a .txt file into an array, count the items in the array, and display a random quote from it.

<p class = "center">
<?php
$Proverb = file('../proverbs.txt');
$ProverbCount = count($Proverb);
	echo rand(0, $ProverbCount-1);
?>
	<br>
	© 2014
</p>

The issue I am having is that it states the file does not exist:

FULL PATH: G:\EasyPHP-5.3.2i\www\PHP_Projects\ChineseZodiacs\Includes\inc_footer.php

TEXT FILE: G:\EasyPHP-5.3.2i\www\PHP_Projects\ChineseZodiacs\proverbs.txt

 

Please help, thank you.

Link to comment
https://forums.phpfreaks.com/topic/291920-turning-a-txt-file-into-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.