I read the file_exists() can also return turn if it points to a directory. What is the fastest way to check if only a file exits?
At the moment I have:
/**
* Check if the file exists.
*
* @return bool
*/
public function exists() {
if(is_null($this->_file)) return false;
return (!is_dir($this->_file) && file_exists($this->_file)) ? true : false;
}
I found lots of posts relating to checking if file exits in PHP but nothing that talks about the directory and how best to check this.
This method can get called 1000s of time so I could really do with making it as fast as possible.