function rules_php_eval

Evaluates the given PHP code, with the given variables defined.

Parameters

string $code: The PHP code to run, including <?php and ?>

array $arguments: Array containing variables to be extracted to the code.

Return value

The output of the php code.

Related topics

1 call to rules_php_eval()
RulesPHPEvaluator::evaluate in modules/php.eval.inc
Evaluates PHP code contained in $text.

File

modules/php.eval.inc, line 152

Code

function rules_php_eval($code, $arguments = array()) {
    extract($arguments);
    ob_start();
    print eval('?>' . $code);
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}