Jump to content

if_exists


kev

Recommended Posts

Hello all.

 

<?php

 

$file_name = ("file_type.php");

if (file_exists($file_name)) {

echo ("$file_name does exist.");

}

else {

echo ("$file_name does not exist.");

}

?>

 

According to the source for this file the echo should have been:

file_type.php does exist.

Unfortunately the oposite happened:

file_type.php does not exist.

 

kev....

 

Link to comment
https://forums.phpfreaks.com/topic/261801-if_exists/
Share on other sites

Hello scootsah.

 

The script is a piece of standalone script from a book turorial. I half guessed that the full path or something was missing but I wondered also if there had been some PHP change somewhere.

By all accounts the book I have is a litany of minor errors most of which were waiting for me.

The next example in line has the same problem but dealing with 'is_readable', 'is_writeable' and 'is_excecutable'. I will take it as a standalone script nothing will work as it is meant to.

Thanks scootsah.

kev

Link to comment
https://forums.phpfreaks.com/topic/261801-if_exists/#findComment-1341534
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.