Take a look at this code, please:
$array = array(
\'action\' => function () { echo \"this works\"; }
);
class Test {
public $array = array(
Try it like this, let me know if this works for you
function () { echo "this works"; });
class Test {
public $arr;
function __construct() {
$this->arr = array("action" => function () { echo "this works too"; });
}
function getArr(){
var_dump($this->arr);
}
}
var_dump($array);
$obj = new Test();
$obj->getArr();