3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr=array( array("count"=>10,"date"=>"2014-04-16"), array("count"=>50,"date"=>"2014-04-18"), array("count"=>80,"date"=>"2014-04-20") ); $date =array("2014-04-16","2014-04-17","2014-04-18","2014-04-19","2014-04-20"); foreach($arr as $val){ $new_arr[$val['date']] = $val['count']; } foreach($date as $key => $val){ $result[$key]['count'] = isset($new_arr[$val]) ? $new_arr[$val] : 0; $result[$key]['date'] = $val; } print_r($result); //对应$date所有日期转换为 $arr=array( array("count"=>10,"date"=>"2014-04-16"), array("count"=>0,"date"=>"2014-04-17"), array("count"=>50,"date"=>"2014-04-18"), array("count"=>0,"date"=>"2014-04-19"), array("count"=>80,"date"=>"2014-04-20"), );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 26
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 26
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 9
filename:       /in/JtoiI
function name:  (null)
number of ops:  32
compiled vars:  !0 = $arr, !1 = $date, !2 = $val, !3 = $new_arr, !4 = $key, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   13     2      > FE_RESET_R                                       $8      !0, ->9
          3    > > FE_FETCH_R                                               $8, !2, ->9
   14     4    >   FETCH_DIM_R                                      ~9      !2, 'date'
          5        FETCH_DIM_R                                      ~11     !2, 'count'
          6        ASSIGN_DIM                                               !3, ~9
          7        OP_DATA                                                  ~11
   13     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $8
   16    10      > FE_RESET_R                                       $12     !1, ->26
         11    > > FE_FETCH_R                                       ~13     $12, !2, ->26
         12    >   ASSIGN                                                   !4, ~13
   17    13        ISSET_ISEMPTY_DIM_OBJ                         0          !3, !2
         14      > JMPZ                                                     ~17, ->18
         15    >   FETCH_DIM_R                                      ~18     !3, !2
         16        QM_ASSIGN                                        ~19     ~18
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~19     0
         19    >   FETCH_DIM_W                                      $15     !5, !4
         20        ASSIGN_DIM                                               $15, 'count'
         21        OP_DATA                                                  ~19
   18    22        FETCH_DIM_W                                      $20     !5, !4
         23        ASSIGN_DIM                                               $20, 'date'
         24        OP_DATA                                                  !2
   16    25      > JMP                                                      ->11
         26    >   FE_FREE                                                  $12
   20    27        INIT_FCALL                                               'print_r'
         28        SEND_VAR                                                 !5
         29        DO_ICALL                                                 
   23    30        ASSIGN                                                   !0, <array>
   34    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.78 ms | 1388 KiB | 15 Q