3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr1 = [1,2,3]; $arr2 = ["A","B","C"]; $arr = [["A"=>$arr1, "B"=>$arr2],["B"=>$arr1, "C"=>$arr2]]; $callback = function($v1, $v2){ return $v1."-".$v2; }; reset($arr[0]); reset($arr[1]); $res = []; while (current($arr[0]) !== false){ $key = key($arr[0])."-".key($arr[1]); $value = array_map($callback, current($arr[0]), current($arr[1])); $res[$key] = $value; next($arr[0]); next($arr[1]); } print_r($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 21
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 21
Branch analysis from position: 62
Branch analysis from position: 21
filename:       /in/b8hqo
function name:  (null)
number of ops:  66
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $arr, !3 = $callback, !4 = $res, !5 = $key, !6 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    5     2        INIT_ARRAY                                           ~9      !0, 'A'
          3        ADD_ARRAY_ELEMENT                                    ~9      !1, 'B'
          4        INIT_ARRAY                                           ~10     ~9
          5        INIT_ARRAY                                           ~11     !0, 'B'
          6        ADD_ARRAY_ELEMENT                                    ~11     !1, 'C'
          7        ADD_ARRAY_ELEMENT                                    ~10     ~11
          8        ASSIGN                                                       !2, ~10
    8     9        DECLARE_LAMBDA_FUNCTION                              ~13     [0]
         10        ASSIGN                                                       !3, ~13
    9    11        INIT_FCALL                                                   'reset'
         12        FETCH_DIM_W                                          $15     !2, 0
         13        SEND_REF                                                     $15
         14        DO_ICALL                                                     
   10    15        INIT_FCALL                                                   'reset'
         16        FETCH_DIM_W                                          $17     !2, 1
         17        SEND_REF                                                     $17
         18        DO_ICALL                                                     
   11    19        ASSIGN                                                       !4, <array>
   12    20      > JMP                                                          ->56
   13    21    >   INIT_FCALL                                                   'key'
         22        FETCH_DIM_R                                          ~20     !2, 0
         23        SEND_VAL                                                     ~20
         24        DO_ICALL                                             $21     
         25        CONCAT                                               ~22     $21, '-'
         26        INIT_FCALL                                                   'key'
         27        FETCH_DIM_R                                          ~23     !2, 1
         28        SEND_VAL                                                     ~23
         29        DO_ICALL                                             $24     
         30        CONCAT                                               ~25     ~22, $24
         31        ASSIGN                                                       !5, ~25
   14    32        INIT_FCALL                                                   'array_map'
         33        SEND_VAR                                                     !3
         34        INIT_FCALL                                                   'current'
         35        FETCH_DIM_R                                          ~27     !2, 0
         36        SEND_VAL                                                     ~27
         37        DO_ICALL                                             $28     
         38        SEND_VAR                                                     $28
         39        INIT_FCALL                                                   'current'
         40        FETCH_DIM_R                                          ~29     !2, 1
         41        SEND_VAL                                                     ~29
         42        DO_ICALL                                             $30     
         43        SEND_VAR                                                     $30
         44        DO_ICALL                                             $31     
         45        ASSIGN                                                       !6, $31
   15    46        ASSIGN_DIM                                                   !4, !5
         47        OP_DATA                                                      !6
   16    48        INIT_FCALL                                                   'next'
         49        FETCH_DIM_W                                          $34     !2, 0
         50        SEND_REF                                                     $34
         51        DO_ICALL                                                     
   17    52        INIT_FCALL                                                   'next'
         53        FETCH_DIM_W                                          $36     !2, 1
         54        SEND_REF                                                     $36
         55        DO_ICALL                                                     
   12    56    >   INIT_FCALL                                                   'current'
         57        FETCH_DIM_R                                          ~38     !2, 0
         58        SEND_VAL                                                     ~38
         59        DO_ICALL                                             $39     
         60        TYPE_CHECK                                      1018          $39
         61      > JMPNZ                                                        ~40, ->21
   20    62    >   INIT_FCALL                                                   'print_r'
         63        SEND_VAR                                                     !4
         64        DO_ICALL                                                     
         65      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b8hqo
function name:  {closure:/in/b8hqo:8}
number of ops:  6
compiled vars:  !0 = $v1, !1 = $v2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        CONCAT                                               ~2      !0, '-'
          3        CONCAT                                               ~3      ~2, !1
          4      > RETURN                                                       ~3
          5*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.92 ms | 2777 KiB | 19 Q