Some code uses eval()
to execute code stored in an array like this:
// $oOwner is an object
$strId = "abc";
$strClass = "someClass";
$aParams = array('a' => 'atext', 'b' => 'btext');
$this->menu = array(
"Entry 1" => ' openForm(\$oOwner,\$strId,\$strClass,\$aParams); ',
// ...
);
The values of the array's keys will be given directly into an eval()
function.
Now I get an error: Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING ... eval()'d code on line 1
What is the problem?
EDIT:
Loop through the array and eval()
the values:
eval( $this->menu[$param[0]] );
EDIT 2:
Now: "Entry 1" => " openForm(\$this->owner,\$strId,\$strClass,\$aParams); "
Using double quotes "..."
leads to PHP Notice: Undefined variable: strId in ... : eval()'d code on line 1
. Also for the other variables.
`