1
At least I tried, but PHP plays a syntax error:
Parse error: syntax error, Unexpected 'Function' (T_FUNCTION)
In short, I cannot declare functions in my array.
When I create my array $ast
outside the class block PMoon
, works. There is some other way to declare this array containing functions?
<?php
/* ... */
class PMoon {
/* ... */
public $ast = array(
"labelStatement" => function($label) { // o erro começa aqui
return array(
"type" => 'LabelStatement',
"label" => $label
);
}
/* ... */
);
/* ... */
}