<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>  Is there a macro preprocessor that can be used to substitute arbitrary
>  sections of code with different code? define is documented as working
>  for rvals only and my attempts to produce something more meaty lead to
>  parse errors.

You could define the code as a function, then check which version of the
function to use...

<?php
define("DEBUG", true);

if (defined("DEBUG") and DEBUG==true) {
    function myMacroizedCode() {
        echo "This is debug-mode code";
    }
}
else {
    function myMacroizedCode() {
        echo "This is non-debug code";
    }
}

for ($i = 0; $i < 100; $i++)
    myMacroizedCode();
?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to