Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
変数の秒数を増やす方法は?
日付を増やすために..:
date("m/d/Y h:i:s a", time() + 30);
しかし、私はこれをしたい:
$seconds = 59; $increase = 3; $result = $seconds + $increase; // 62
60秒で停止して再計算したいのですが、結果は60ではなく2になるはずです。
モジュラス演算子が必要です。
$seconds = 59; $increase = 3; $result = ($seconds + $increase) % 60; // 2