3v4l.org

run code in 500+ PHP versions simultaneously
<?php $months = [ 'January', 'January', 'January', 'January', 'February' ]; $weeks = [ 'Week 1', 'Week 2', 'Week 3', 'Week 4', 'Week 1' ]; $newArray = array_map(function($index, $month) use ($weeks) { return $month . ' - ' . $weeks[$index]; }, array_keys($months), $months); print_r($newArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ABJtf
function name:  (null)
number of ops:  17
compiled vars:  !0 = $months, !1 = $weeks, !2 = $newArray
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   11     1        ASSIGN                                                       !1, <array>
   19     2        INIT_FCALL                                                   'array_map'
          3        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          4        BIND_LEXICAL                                                 ~5, !1
   23     5        SEND_VAL                                                     ~5
          6        INIT_FCALL                                                   'array_keys'
          7        SEND_VAR                                                     !0
          8        DO_ICALL                                             $6      
          9        SEND_VAR                                                     $6
         10        SEND_VAR                                                     !0
   19    11        DO_ICALL                                             $7      
         12        ASSIGN                                                       !2, $7
   25    13        INIT_FCALL                                                   'print_r'
         14        SEND_VAR                                                     !2
         15        DO_ICALL                                                     
         16      > 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/ABJtf
function name:  {closure:/in/ABJtf:19}
number of ops:  8
compiled vars:  !0 = $index, !1 = $month, !2 = $weeks
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
   21     3        CONCAT                                               ~3      !1, '+-+'
          4        FETCH_DIM_R                                          ~4      !2, !0
          5        CONCAT                                               ~5      ~3, ~4
          6      > RETURN                                                       ~5
   23     7*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.8 ms | 1909 KiB | 16 Q