formatter php problem

formatter php problem

ajutorlotostatsajutorlotostats Posts: 2Questions: 1Answers: 0
edited November 2018 in Free community support

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

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394
    edited November 2018

    $ora_extragere = date('H:i', strtotime($ora_extragere .' '.$rule.''));

    Bad syntax. You have a double quotation mark after $rule.

  • ajutorlotostatsajutorlotostats Posts: 2Questions: 1Answers: 0

    I had write here wrong.

    Syntax is good. I think the problem is because variable $rule is inside function.

This discussion has been closed.