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 $k =>$v ){ //if(!array_key_exists($v['date'],$date)){ // $arr[]=array("count"=>0,"date"=>$date) //} $tt[]=$v['date'];$cc[]=$v['count']; $new['date']=$v["count"]; } print_r(array_combine($date,$new)); foreach($new as $k =>$v){ } foreach($arr as $k2 =>$v2 ){foreach($date as $k =>$v ){ if(!array_key_exists($v,$tt)){ $arr[]=array("count"=>0,"date"=>$v); } } } print_r($arr); //对应$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 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 27
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 44
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 44
Branch analysis from position: 30
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 42
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 42
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 41
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 42
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
Branch analysis from position: 27
Branch analysis from position: 15
filename:       /in/j90Bi
function name:  (null)
number of ops:  50
compiled vars:  !0 = $arr, !1 = $date, !2 = $v, !3 = $k, !4 = $tt, !5 = $cc, !6 = $new, !7 = $v2, !8 = $k2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   14     2      > FE_RESET_R                                       $11     !0, ->15
          3    > > FE_FETCH_R                                       ~12     $11, !2, ->15
          4    >   ASSIGN                                                   !3, ~12
   18     5        FETCH_DIM_R                                      ~15     !2, 'date'
          6        ASSIGN_DIM                                               !4
          7        OP_DATA                                                  ~15
          8        FETCH_DIM_R                                      ~17     !2, 'count'
          9        ASSIGN_DIM                                               !5
         10        OP_DATA                                                  ~17
   19    11        FETCH_DIM_R                                      ~19     !2, 'count'
         12        ASSIGN_DIM                                               !6, 'date'
         13        OP_DATA                                                  ~19
   14    14      > JMP                                                      ->3
         15    >   FE_FREE                                                  $11
   22    16        INIT_FCALL                                               'print_r'
         17        INIT_FCALL                                               'array_combine'
         18        SEND_VAR                                                 !1
         19        SEND_VAR                                                 !6
         20        DO_ICALL                                         $20     
         21        SEND_VAR                                                 $20
         22        DO_ICALL                                                 
   23    23      > FE_RESET_R                                       $22     !6, ->27
         24    > > FE_FETCH_R                                       ~23     $22, !2, ->27
         25    >   ASSIGN                                                   !3, ~23
         26      > JMP                                                      ->24
         27    >   FE_FREE                                                  $22
   27    28      > FE_RESET_R                                       $25     !0, ->44
         29    > > FE_FETCH_R                                       ~26     $25, !7, ->44
         30    >   ASSIGN                                                   !8, ~26
         31      > FE_RESET_R                                       $28     !1, ->42
         32    > > FE_FETCH_R                                       ~29     $28, !2, ->42
         33    >   ASSIGN                                                   !3, ~29
   28    34        ARRAY_KEY_EXISTS                                 ~31     !2, !4
         35        BOOL_NOT                                         ~32     ~31
         36      > JMPZ                                                     ~32, ->41
   29    37    >   INIT_ARRAY                                       ~34     0, 'count'
         38        ADD_ARRAY_ELEMENT                                ~34     !2, 'date'
         39        ASSIGN_DIM                                               !0
         40        OP_DATA                                                  ~34
   27    41    > > JMP                                                      ->32
         42    >   FE_FREE                                                  $28
         43      > JMP                                                      ->29
         44    >   FE_FREE                                                  $25
   33    45        INIT_FCALL                                               'print_r'
         46        SEND_VAR                                                 !0
         47        DO_ICALL                                                 
   37    48        ASSIGN                                                   !0, <array>
   48    49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.28 ms | 1405 KiB | 17 Q