fork(1) download
  1. <?php
  2.  
  3. $numbers = [21.3333, 65.3333, 13.3333];
  4.  
  5. $roundeds = array_map("round", array_slice($numbers, 0, -1));
  6. $roundeds[] = (int) 100 - array_sum($roundeds);
  7.  
  8. print_r($roundeds);
Success #stdin #stdout 0.02s 23408KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 21
    [1] => 65
    [2] => 14
)