i have problem closure in php 5.4
i have array
public function check(){ return ['int'=>['filter'=>2], 'min'=>function($val){ return ['int'=>2,'min'=>$val]; } ] }
when use
(new obj())->check()['int'];
it works. don't know how use min parameter example 3
i tryed
(new obj())->check()['min'](3); (new obj())->check()['min'(3)]; (new obj())->check()['min(3)'];
don't work.
php's parser not task, can't write expression have in other languages. have use workaround, example:
call_user_func((new obj())->check()['min'], 3));
or alternatively:
$f = (new obj())->check()['min']; $f(3);
Comments
Post a Comment