Function __global->cms_eval

Definitions

sources/global3.php

  • Run some code. Bail out on failure.We cannot always use this over 'eval' because the code will run in a separate scope.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$code string No No required parameter N/A N/A Code to eval
$context string No No required parameter N/A N/A A context, used in error messages, to help understand where errors may be
$trigger_error boolean No No True N/A N/A Trigger fatal error; even if false an error will be attached

Returns

  • The error response
  • Type: mixed
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Run some code. Bail out on failure.We cannot always use this over 'eval' because the code will run in a separate scope.
 *
 * @param  string $code Code to eval
 * @param  string $context A context, used in error messages, to help understand where errors may be
 * @param  boolean $trigger_error Trigger fatal error; even if false an error will be attached
 * @return mixed The error response
 */

function cms_eval(string $code, string $context, bool $trigger_error = true)