3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = array( 0 => 'number 1', 1 => 'number 2', 2 => 'number 3', 3 => 'number 4', 4 => 'number 5', ) ; $arr2 = array( 0 => 'number 4 insert', 1 => 'number 8 insert', 2 => 'number 12 insert', 3 => 'number 16 insert', 4 => 'number 24 insert', ) ; function match_arrayKeys ($x, $y,$z) { $keys = array_keys ($x); for ($i = 0; $i < count ($keys); $i++) { $j = $i+1; if($j%$z== 0 ){ $newarray [$i] = $y[$keys[$i]]; } else { $newarray [$i] = $x[$i]; } } return $newarray; } print_r (match_arrayKeys ($arr1,$arr2, 4));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/spdep
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr1, !1 = $arr2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   37     2        INIT_FCALL                                               'print_r'
          3        INIT_FCALL                                               'match_arraykeys'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 4
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function match_arraykeys:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 9
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 9
Branch analysis from position: 26
Branch analysis from position: 9
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 9
Branch analysis from position: 26
Branch analysis from position: 9
filename:       /in/spdep
function name:  match_arrayKeys
number of ops:  28
compiled vars:  !0 = $x, !1 = $y, !2 = $z, !3 = $keys, !4 = $i, !5 = $j, !6 = $newarray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   22     3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !3, $7
   24     7        ASSIGN                                                   !4, 0
          8      > JMP                                                      ->23
   26     9    >   ADD                                              ~10     !4, 1
         10        ASSIGN                                                   !5, ~10
   27    11        MOD                                              ~12     !5, !2
         12        IS_EQUAL                                                 ~12, 0
         13      > JMPZ                                                     ~13, ->19
   28    14    >   FETCH_DIM_R                                      ~15     !3, !4
         15        FETCH_DIM_R                                      ~16     !1, ~15
         16        ASSIGN_DIM                                               !6, !4
         17        OP_DATA                                                  ~16
   27    18      > JMP                                                      ->22
   30    19    >   FETCH_DIM_R                                      ~18     !0, !4
         20        ASSIGN_DIM                                               !6, !4
         21        OP_DATA                                                  ~18
   24    22    >   PRE_INC                                                  !4
         23    >   COUNT                                            ~20     !3
         24        IS_SMALLER                                               !4, ~20
         25      > JMPNZ                                                    ~21, ->9
   34    26    > > RETURN                                                   !6
   35    27*     > RETURN                                                   null

End of function match_arraykeys

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.63 ms | 1006 KiB | 16 Q