Is $expire a global value?
Posted on 2005-05-16
I have no PHP experience, but am familiar with perl and some other languages. I'm using a PHP script from the Open Source community. It is a front end to a MySQL database.
One of the functions selects distinct hosts from the database. It then populates the webpage, but also writes them to a text file. Then on subsequent calls, it checks that text file, and if it exists, and is recent, is uses that list to populate the web form, instead of doing the SQL Select (to save overhead).
But I'm jsut trying to understand when it decides to use the text file. The code says:
if (file_exists($file) && filemtime($file) > (time() - $expire))
Can someone explain that line to me. It's checking the date stamp of the file, and comparing it to the current time minux $expire. I can't find $expire defined anywhere. Is that a global PHP thing?