Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $data = [
- 0=>[
- 'bulan'=>11,
- 'total_order'=>10],
- 1=>[
- 'bulan'=>12,
- 'total_order'=>1
- ]
- ];
- for ($i=1; $i <= date("m", strtotime(date("Y-m", strtotime('m')))); $i++) {
- foreach ($data as $key => $value) {
- if($value['bulan'] == $i){
- $result[$i] = $value['total_order'];
- } else {
- $result[$i] = 0;
- }
- }
- }
- echo "<pre>";
- print_r($result);
- echo "</pre>";
- die;
- Array
- (
- [1] => 0
- [2] => 0
- [3] => 0
- [4] => 0
- [5] => 0
- [6] => 0
- [7] => 0
- [8] => 0
- [9] => 0
- [10] => 0
- [11] => 0
- [12] => 1
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement