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.
階数をすべて18倍にする関数の作り方は?
例:
3 => 0 17 => 0 19 => 18 43 => 36 69 => 54
ありがとう。
$a = 19; $a -= $a % 18; // => 18
モジュラス演算子 (%) を使用して
$a % $b = gives the remainder of $a divided by $b.
あなたの場合、
$a = 3; $a = $a - ($a % 18);