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.
PHPで数値のパーセンテージを計算したいと思います。例えば:
$percentage = 50; $totalWidth = 350;
この例では、350 の 50% = 175
どうやってやるの?
$percentage = 50; $totalWidth = 350; $new_width = ($percentage / 100) * $totalWidth;
100 で割り$percentage、 を掛け$totalWidthます。簡単な数学。
$percentage
$totalWidth