PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $amount = 27; $wareh = 4 $wareh_id = [ /*'3' => 3, '2' => 2, '1' => 1, '0' => 0*/ ]; arsort($wareh_id); $i= 0; $arr=[]; foreach($wareh_id as $key=>$value){ $arr[$key] = floor($amount / ($wareh - $i)); $i++; } $arr[$key] += $num - array_sum($arr);
Show:  
Copy Clear