Or in other words, is there a PHP equivalent of the C++ directives #ifndef, #define which are used to accomplish this?
I figure this will work:
<?php
if(!class_exists("MyClass")):
class MyClass
{
...
}
endif;
?>
This avoids the overhead that comes with require_once/include_once functions.
Well if you really like conditional including to reduce "PHP symbol table" you can code like C preprocessor directives like this:
IF ( !defined( 'MY_CONSTANT' ):
define( 'MY_CONSTANT', 'PHP C like defined' );
ENDIF;
IF ( !defined( 'header_php' ):
define( 'header_php', 'PHP "header" defined' );
include( 'header.php' );
ENDIF;
// you can do this for class, functions, variables etc
But on the end will have additional cosntants symbols defined for nothing.