Check that file exists: Difference between revisions

The loop was just confusing
m (Added to <20 category)
(The loop was just confusing)
Line 109:
 
=={{header|PHP}}==
if (file_exists('input.txt')) echo 'input.txt is here right by my side';
// List of files.
if (file_exists('docs' )) echo 'docs is here with me';
$files = array('./input.txt','./docs','/input.txt','/docs');
if (file_exists('/input.txt)) echo 'input.txt is over there in the root dir';
// Process Each File
if (file_exists('/docs' )) echo 'docs is over ther in the root dir';
foreach($files as $fileToCheck){
// List Findings
print "The file ";
if( file_exists($fileToCheck) ){
print $fileToCheck." exists.\n";
}else{
print $fileToCheck." does not exist.\n";
}
}
 
=={{header|Perl}}==
Anonymous user