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']; } foreach($date as $k =>$v ){ foreach($arr as $k2 =>$v2 ){ 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 = 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 = 77) Position 1 = 14, Position 2 = 24
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 24
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 23
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 24
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/uN9aN
function name:  (null)
number of ops:  32
compiled vars:  !0 = $arr, !1 = $date, !2 = $v, !3 = $k, !4 = $tt, !5 = $v2, !6 = $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                                       $9      !0, ->9
          3    > > FE_FETCH_R                                       ~10     $9, !2, ->9
          4    >   ASSIGN                                                   !3, ~10
   18     5        FETCH_DIM_R                                      ~13     !2, 'date'
          6        ASSIGN_DIM                                               !4
          7        OP_DATA                                                  ~13
   14     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $9
   21    10      > FE_RESET_R                                       $14     !1, ->26
         11    > > FE_FETCH_R                                       ~15     $14, !2, ->26
         12    >   ASSIGN                                                   !3, ~15
   22    13      > FE_RESET_R                                       $17     !0, ->24
         14    > > FE_FETCH_R                                       ~18     $17, !5, ->24
         15    >   ASSIGN                                                   !6, ~18
   23    16        ARRAY_KEY_EXISTS                                 ~20     !2, !4
         17        BOOL_NOT                                         ~21     ~20
         18      > JMPZ                                                     ~21, ->23
   24    19    >   INIT_ARRAY                                       ~23     0, 'count'
         20        ADD_ARRAY_ELEMENT                                ~23     !2, 'date'
         21        ASSIGN_DIM                                               !0
         22        OP_DATA                                                  ~23
   22    23    > > JMP                                                      ->14
         24    >   FE_FREE                                                  $17
   21    25      > JMP                                                      ->11
         26    >   FE_FREE                                                  $14
   28    27        INIT_FCALL                                               'print_r'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                                 
   32    30        ASSIGN                                                   !0, <array>
   43    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.85 ms | 945 KiB | 16 Q