日付でいくつかの操作を行う必要があります。DB スクリプトから、アクションの日付と頻度 (例: 21 日) を読み取り、実際の日付から次のアクションがいつになるかを計算する必要があります。いくつかの方法でこれを実行しようとしました (英語で書くのは難しいので、以下にコードを示します)。
//$unix_on - date from DB
//$devices[$i]['freq'] - frequency of actions
$unix_on=strtotime($devices[$i]['date_on']);
$unix_today=strtotime(date('Y-m-d'));
$actions=($unix_today-$unix_on)/(86400*$devices[$i]['freq']);
$b=explode(".", $actions);
$a='0'.'.'.$b['1'];
$f=$a*$devices[$i]['freq'];
$d=$unix_today+($f*86400);
$e=date("Y-m-d",$d);
しかし、うまくいきません。計算にエラーがあり、その理由がわかりません。