3v4l.org

run code in 300+ PHP versions simultaneously
<?php $folderTree = ['files','js','plugins']; $values = ['plugin1.js', 'plugin2.js']; $result = array_reduce(array_reverse($folderTree), function (array $value, $folder) { return [$folder => $value]; }, $values); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rb7Zi
function name:  (null)
number of ops:  16
compiled vars:  !0 = $folderTree, !1 = $values, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'array_reduce'
          3        INIT_FCALL                                               'array_reverse'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Frb7Zi%3A5%240'
    7     8        SEND_VAL                                                 ~6
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $7      
    5    11        ASSIGN                                                   !2, $7
    9    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Frb7Zi%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rb7Zi
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $value, !1 = $folder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_ARRAY                                       ~2      !0, !1
          3      > RETURN                                                   ~2
    7     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Frb7Zi%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.83 ms | 1395 KiB | 19 Q