Fail safe includes and requires

#1

http://www.acecoolco.com/tutorials/3/fail-safe-includes-and-requires/page_1/tutorial_24.html

This tutorial shows you how to use a built in php check to safely remove errors

Code added for ease of use:

This check checks that a file exists before including it.
PHP Code Box

[php]

<?php if (file_exists("./path/to/file.php")) { include("./path/to/file.php"); } ?>

[/php]

This check checks that a file exists before requiring it.
PHP Code Box

[php]

<?php if (file_exists("./path/to/file.php")) { require("./path/to/file.php"); } ?>

[/php]

If you wanted to add an error message to these, simply add an else statement.
PHP Code Box

[php]

<?php if (file_exists("./path/to/file.php")) { require("./path/to/file.php"); } else { echo "./path/to/file.php File was not included / required."; } ?>

[/php]