Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Sourse : https://stackoverflow.com/questions/47832429/php-division-with-no-decimal-separate-result
- $numbertodivise = 500;
- $no = 3;
- $intnumber = intval($numbertodivise / $no);
- $rem = $numbertodivise % $no;
- $array = [];
- for($i=1;$i<=$no;$i++) {
- if($i==$no) {
- $array[] = $intnumber + $rem;
- } else {
- $array[] = $intnumber;
- }
- }
- echo "<pre>";
- print_r($array);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement