I want to define a custom function and use that in Volts and contollers simulteniously. I tried this way
$di->set('en2bn', function ($input) {
$bn_digits = array('০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯');
$output = str_replace(range(0, 9), $bn_digits, $input);
return $output;
});
and tried to access within controller this way
$this->en2bn(8);
And got error. Can you please advice me?