3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = [['A','B','C'],[1,2,3],[4,5,6],[7,8,9]]; $headers = array_shift($x); array_walk( $x, function(&$row) use ($headers) { $row = array_combine($headers, $row); } ); $y = json_export($x,true); echo $y;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qMFAR
function name:  (null)
number of ops:  18
compiled vars:  !0 = $x, !1 = $headers, !2 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'array_shift'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    6     5        INIT_FCALL                                               'array_walk'
    7     6        SEND_REF                                                 !0
    8     7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FqMFAR%3A8%240'
          8        BIND_LEXICAL                                             ~6, !1
   10     9        SEND_VAL                                                 ~6
         10        DO_ICALL                                                 
   13    11        INIT_FCALL_BY_NAME                                       'json_export'
         12        SEND_VAR_EX                                              !0
         13        SEND_VAL_EX                                              <true>
         14        DO_FCALL                                      0  $8      
         15        ASSIGN                                                   !2, $8
   14    16        ECHO                                                     !2
         17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FqMFAR%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qMFAR
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $row, !1 = $headers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    9     2        INIT_FCALL                                               'array_combine'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !0, $2
   10     7      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FqMFAR%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.81 ms | 1395 KiB | 19 Q