webCOMAND

#PHP_EXPORT

Convert a cTemplate value to a parsable string representation of a value in PHP code. It will produce the same output as the var_export() function in PHP.

Prototype

#PHP_EXPORT($value)

Parameters

  • value - A value that should be converted to variable containing

Return

A parsable string representation of the value.

Example

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

#/ Publish the value of two cTemplate variables to PHP code.
#ASSIGN($var1, 'a string')
#ASSIGN($var2, [1, 2, 3])
<?php
$$var1 = #PHP_EXPORT($var1);
$$var2 = #PHP_EXPORT($var2);
?>

Related

#CSCRIPT, #EVAL, #PHP