You are here

function rules_php_eval in Rules 6

Same name and namespace in other branches
  1. 7.2 modules/php.eval.inc \rules_php_eval()

Evalutes the given PHP code, with the given variables defined. This is like drupal_eval() but allows to pass some arguments to the code.

Parameters

$code The PHP code to run, with <?php ?>:

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

Return value

The output of the php code.

Related topics

1 string reference to 'rules_php_eval'
rules_input_evaluator_php_apply in rules/modules/php.rules.inc
Apply the input evaluator.

File

rules/modules/php.rules.inc, line 84
rules integration for the php module This provides an php input evaluator as well as a execute php code action.

Code

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