3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a=array('a0','a1','a2','a3','a4','a5'); $b=array('b0','b1','b2','b3','b4','b5'); $flip = TRUE; $merged = array_map(function($v1, $v2)use(&$flip){ if($flip = !$flip ? TRUE : FALSE) return [$v2[0], $v1[0], $v2[1], $v1[1]]; return [$v1[0], $v2[0], $v1[1], $v2[1]]; }, array_chunk($a, 2), array_chunk($b, 2)); print_r($merged);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XZdhe
function name:  (null)
number of ops:  23
compiled vars:  !0 = $a, !1 = $b, !2 = $flip, !3 = $merged
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, <true>
    7     3        INIT_FCALL                                               'array_map'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FXZdhe%3A7%240'
          5        BIND_LEXICAL                                             ~7, !2
   11     6        SEND_VAL                                                 ~7
          7        INIT_FCALL                                               'array_chunk'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 2
         10        DO_ICALL                                         $8      
         11        SEND_VAR                                                 $8
         12        INIT_FCALL                                               'array_chunk'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 2
         15        DO_ICALL                                         $9      
         16        SEND_VAR                                                 $9
         17        DO_ICALL                                         $10     
    7    18        ASSIGN                                                   !3, $10
   13    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FXZdhe%3A7%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
Branch analysis from position: 19
filename:       /in/XZdhe
function name:  {closure}
number of ops:  29
compiled vars:  !0 = $v1, !1 = $v2, !2 = $flip
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    8     3        BOOL_NOT                                         ~3      !2
          4      > JMPZ                                                     ~3, ->7
          5    >   QM_ASSIGN                                        ~4      <true>
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~4      <false>
          8    >   ASSIGN                                           ~5      !2, ~4
          9      > JMPZ                                                     ~5, ->19
    9    10    >   FETCH_DIM_R                                      ~6      !1, 0
         11        INIT_ARRAY                                       ~7      ~6
         12        FETCH_DIM_R                                      ~8      !0, 0
         13        ADD_ARRAY_ELEMENT                                ~7      ~8
         14        FETCH_DIM_R                                      ~9      !1, 1
         15        ADD_ARRAY_ELEMENT                                ~7      ~9
         16        FETCH_DIM_R                                      ~10     !0, 1
         17        ADD_ARRAY_ELEMENT                                ~7      ~10
         18      > RETURN                                                   ~7
   10    19    >   FETCH_DIM_R                                      ~11     !0, 0
         20        INIT_ARRAY                                       ~12     ~11
         21        FETCH_DIM_R                                      ~13     !1, 0
         22        ADD_ARRAY_ELEMENT                                ~12     ~13
         23        FETCH_DIM_R                                      ~14     !0, 1
         24        ADD_ARRAY_ELEMENT                                ~12     ~14
         25        FETCH_DIM_R                                      ~15     !1, 1
         26        ADD_ARRAY_ELEMENT                                ~12     ~15
         27      > RETURN                                                   ~12
   11    28*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FXZdhe%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.37 ms | 1400 KiB | 19 Q