3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jobs = [ ['count' => 3, 'yearmonth' => '2019-7'], ['count' => 3, 'yearmonth' => '2019-9'], ['count' => 5, 'yearmonth' => '2019-10'], ]; $dates = [ ['yearmonth' => '2019-6'], ['yearmonth' => '2019-7'], ['yearmonth' => '2019-8'], ['yearmonth' => '2019-9'], ['yearmonth' => '2019-10'], ]; $lookup = array_column($jobs, 'count', 'yearmonth'); foreach ($dates as &$date) { $date['count'] = $lookup[$date['yearmonth']] ?? 0; } var_export($dates);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 126) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/Ct9Yl
function name:  (null)
number of ops:  22
compiled vars:  !0 = $jobs, !1 = $dates, !2 = $lookup, !3 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   16     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'count'
          5        SEND_VAL                                                 'yearmonth'
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
   18     8      > FE_RESET_RW                                      $8      !1, ->17
          9    > > FE_FETCH_RW                                              $8, !3, ->17
   19    10    >   FETCH_DIM_R                                      ~10     !3, 'yearmonth'
         11        FETCH_DIM_IS                                     ~11     !2, ~10
         12        COALESCE                                         ~12     ~11
         13        QM_ASSIGN                                        ~12     0
         14        ASSIGN_DIM                                               !3, 'count'
         15        OP_DATA                                                  ~12
   18    16      > JMP                                                      ->9
         17    >   FE_FREE                                                  $8
   22    18        INIT_FCALL                                               'var_export'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.9 ms | 953 KiB | 15 Q