PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function split_number($num, $count) { $result = []; for ($i = 1; $i<$count; $i++) { $result[$i] = rand(1, $num / 2); $num -= $result[$i]; } $result[0] = $num; return $result; } $chunks = split_number(500, 5); var_export($chunks); echo array_sum($chunks);
Show:  
Copy Clear