#ifdef in PHP
Decision
So I decided to use the # ifdef / # endif directives. To implement them, I created a small program in C # that processes these directives. In the program, you need to specify the source file or folder, and the folder where you want to put the finished result. Only php files are processed for directives, the rest are simply copied.

Program work
The program has a global array defines, which is created from the third field ("Defines (comma separated)"). This array can be supplemented with the “#define TEXT” directive in php code.
The program can process the following directives: "#ifdef TEXT", "#ifndef TEXT". The first includes code if the directive is defined, the second includes if not defined. These directives must have a closing "#endif".
The program is also able to handle the "#else" and nesting of these directives.
Conclusion
Since the php symbol “#" defines a comment, the code can be executed without cutting these directives.
However, if you use "#ifdef - #else - #endif" with code that performs different actions with the same data, you need to comment out one of these actions to execute it without cutting directives in approximately the following way: You can download the program here: phpifdef. googlecode.com/files/Php%20Ifdef%20Collector.exe Program sources here: code.google.com/p/phpifdef
#ifdef COPY
$chat_page = new View('copy');
$chat_page->SetVars(array('copyright' => $this->Copyright()));
$this->html = $chat_page->Get();
$this->Display();
/*#else
$this->html = View('no_copy')::Call();
$this->Display();
*/#endif
?>