webCOMAND

#PHP

Evaluates PHP code. All top-level (aka "in context") cTemplate variables are accessible in the block as PHP variables.  It is similar to the #CALC command, except a block of PHP code can be entered with line breaks, etc.  The last value set will output .

Prototype

#PHP ... #ENDPHP

Return

The value returned by PHP with a return statement, or the last value set.

Example

Here we will insert the contents of a file from a remote website.

#/ Output: FUNKY EXAMPLE
#NEW($var)FuNKy Example#ENDNEW
#PHP
    strtoupper($var);
#ENDPHP

Related

#CSCRIPT, #EVAL, #PERL, #PHP_EXPORT()