3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "a-b-c"; $val = "something"; $result = array_reduce( array_reverse(explode('-', $string)), function ($val, $key) { return array($key => $val); }, $val ); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e35Kb
function name:  (null)
number of ops:  20
compiled vars:  !0 = $string, !1 = $val, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'a-b-c'
    4     1        ASSIGN                                                   !1, 'something'
    6     2        INIT_FCALL                                               'array_reduce'
    7     3        INIT_FCALL                                               'array_reverse'
          4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '-'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                         $6      
         10        SEND_VAR                                                 $6
    8    11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fe35Kb%3A8%240'
         12        SEND_VAL                                                 ~7
    9    13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $8      
    6    15        ASSIGN                                                   !2, $8
   12    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199.65 ms | 1400 KiB | 21 Q