formatter php problem
formatter php problem
Hello,
I have this php code that works:
.....
array( 'db' => 'ora_extragere', 'dt' => 1,
'formatter' => function($ora_extragere) {
$ora_extragere = date('H:i', strtotime($ora_extragere .' +1 hour +0 minutes'));
return $ora_extragere;
}),
.....
But this not work:
$rule="+1 hour +0 minutes";
.....
array( 'db' => 'ora_extragere', 'dt' => 1,
'formatter' => function($ora_extragere) {
$ora_extragere = date('H:i', strtotime($ora_extragere .' '.$rule.''));
return $ora_extragere;
}),
.....
Why?
Thank you.
Answers
Bad syntax. You have a double quotation mark after $rule.
I had write here wrong.
Syntax is good. I think the problem is because variable $rule is inside function.