Check included file exists

This example basically checks whether the include file exists and is readable. A useful little check to have.

 

<?php
$file = ‘includes/includedfile.php’;
if(file_exists($file) && is_readable($file))
{
include($file);
}
?>

LEAVE A REPLY

Please enter your comment!
Please enter your name here

*