formatter php problem
formatter php problem
![ajutorlotostats](https://secure.gravatar.com/avatar/c4b0a80bad1d36d17a3f73d8ca047f48/?default=https%3A%2F%2Fvanillicon.com%2Fc4b0a80bad1d36d17a3f73d8ca047f48_200.png&rating=g&size=120)
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.