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 $k =>$v ){ if(!array_key_exists($v['date'],$date)){ $arr[]=array("count"=>0,"date"=>$date) } }*/ foreach($date as $k =>$v ){ foreach($arr as $k2 =>$v2 ){ if(!array_key_exists($v,$v2['date'])){ $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 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/kg8rh
function name:  (null)
number of ops:  25
compiled vars:  !0 = $arr, !1 = $date, !2 = $v, !3 = $k, !4 = $v2, !5 = $k2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   21     2      > FE_RESET_R                                       $8      !1, ->19
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->19
          4    >   ASSIGN                                                   !3, ~9
   22     5      > FE_RESET_R                                       $11     !0, ->17
          6    > > FE_FETCH_R                                       ~12     $11, !4, ->17
          7    >   ASSIGN                                                   !5, ~12
   23     8        FETCH_DIM_R                                      ~14     !4, 'date'
          9        ARRAY_KEY_EXISTS                                 ~15     !2, ~14
         10        BOOL_NOT                                         ~16     ~15
         11      > JMPZ                                                     ~16, ->16
   24    12    >   INIT_ARRAY                                       ~18     0, 'count'
         13        ADD_ARRAY_ELEMENT                                ~18     !2, 'date'
         14        ASSIGN_DIM                                               !0
         15        OP_DATA                                                  ~18
   22    16    > > JMP                                                      ->6
         17    >   FE_FREE                                                  $11
   21    18      > JMP                                                      ->3
         19    >   FE_FREE                                                  $8
   28    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
   32    23        ASSIGN                                                   !0, <array>
   43    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.96 ms | 1396 KiB | 15 Q