I am trying to include a file if it exists, if the file doesn't exist i would like it to include another file instead.
I have the following code which seems to work correctly, The only problem with my code is if the file does exist then it displays them both.
I would like to only include
include/article.php
if
include/'.$future.'.php
doesn't exist.
if
include/'.$future.'.php
exists i don't want to include
include/article.php
<?php
$page = $_GET['include'];
if (file_exists('include/'.$future.'.php')){
include('include/'.$future.'.php');
}
else{
include('include/article.php');
}
?>
$futureget it's content from? The way it is right now, it is empty and the file "include/.php" should not exist.article.phpsomewhere else as your logic is sound