How to identify that the string is a path to any file, using PHPcode?
Question
Using PHP, How to identify that the string is a path to any file?
Solution
$path = 'string';
if(is_file($path)){
// look, it's a file!
}
OTHER TIPS
is_file($filename)
is_dir($filename)
Will return true
if the string points to an existing file or directory.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow