Using php to iterate through a text file on a timed interval

Hi, I want to set up a small php script which simply returns a string, either from an array or from a line in a text file. As well as returning the string any time this script is called, I also want it to automatically cycle through the set of items (either an array or each line in a text file) on a timed basis. For example, every 15 minutes I want the script to step through each item in the list.

This script is part of an application which will be run on a LAN in a controlled space. What I’m unsure about is whether or not i can use php’s time functions (like sleep()) to continue manipulating the contents of a file over a fixed period of time (3 hours). The script will also be getting called by a client app (Adobe Director) every 30 secs or so, where it will be returning the current element from the file.

I’ve not actually done anything like this before, so i’d be interested to hear any advice. Thanks

To run a program on set intervals you’d normally use cron on linux, or the task scheduler on windows.
Letting it run indefinitely and using sleep() to pause it is not a good idea, since it will still use system resources while it’s “sleeping” (although not much).