3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = Array ( 0 => Array ( 'MONTH' => 5, 'jobseeker' => 4 ), 1 => Array ( 'MONTH' => 6, 'jobseeker' => 4 ) ); $array2 = Array ( 0 => Array ( 'MONTH' => 6, 'company' => 11 ) ); $array3 = Array ( 0 => Array ( 'MONTH' => 6, 'job' => 20 ) ); $seconArrayMonths = array_column($array2,'MONTH'); $thirdArrayMonths = array_column($array3,'MONTH'); foreach($array1 as &$arr){ $secondArrayMonthKey = array_search($arr['MONTH'],$seconArrayMonths); if($secondArrayMonthKey !== false){ $arr['company'] = $array2[$secondArrayMonthKey]['company']; } $thirdArrayMonthKey = array_search($arr['MONTH'],$thirdArrayMonths); if($thirdArrayMonthKey !== false){ $arr['job'] = $array3[$secondArrayMonthKey]['job']; } } print_r($array1);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 14, Position 2 = 40
Branch analysis from position: 14
2 jumps found. (Code = 126) Position 1 = 15, Position 2 = 40
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 39
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 39
Branch analysis from position: 27
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/BKJqj
function name:  (null)
number of ops:  45
compiled vars:  !0 = $array1, !1 = $array2, !2 = $array3, !3 = $seconArrayMonths, !4 = $thirdArrayMonths, !5 = $arr, !6 = $secondArrayMonthKey, !7 = $thirdArrayMonthKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   27     2        ASSIGN                                                   !2, <array>
   38     3        INIT_FCALL                                               'array_column'
          4        SEND_VAR                                                 !1
          5        SEND_VAL                                                 'MONTH'
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !3, $11
   39     8        INIT_FCALL                                               'array_column'
          9        SEND_VAR                                                 !2
         10        SEND_VAL                                                 'MONTH'
         11        DO_ICALL                                         $13     
         12        ASSIGN                                                   !4, $13
   42    13      > FE_RESET_RW                                      $15     !0, ->40
         14    > > FE_FETCH_RW                                              $15, !5, ->40
   43    15    >   INIT_FCALL                                               'array_search'
         16        FETCH_DIM_R                                      ~16     !5, 'MONTH'
         17        SEND_VAL                                                 ~16
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $17     
         20        ASSIGN                                                   !6, $17
   44    21        TYPE_CHECK                                  1018          !6
         22      > JMPZ                                                     ~19, ->27
   45    23    >   FETCH_DIM_R                                      ~21     !1, !6
         24        FETCH_DIM_R                                      ~22     ~21, 'company'
         25        ASSIGN_DIM                                               !5, 'company'
         26        OP_DATA                                                  ~22
   47    27    >   INIT_FCALL                                               'array_search'
         28        FETCH_DIM_R                                      ~23     !5, 'MONTH'
         29        SEND_VAL                                                 ~23
         30        SEND_VAR                                                 !4
         31        DO_ICALL                                         $24     
         32        ASSIGN                                                   !7, $24
   48    33        TYPE_CHECK                                  1018          !7
         34      > JMPZ                                                     ~26, ->39
   49    35    >   FETCH_DIM_R                                      ~28     !2, !6
         36        FETCH_DIM_R                                      ~29     ~28, 'job'
         37        ASSIGN_DIM                                               !5, 'job'
         38        OP_DATA                                                  ~29
   42    39    > > JMP                                                      ->14
         40    >   FE_FREE                                                  $15
   54    41        INIT_FCALL                                               'print_r'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.69 ms | 1007 KiB | 16 Q