3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "prefix" => "api", "slug" => "api", "children" => [ "prefix" => "v1", "slug" => "v1", "children" => [ "prefix" => "tenants", "slug" => "tenants", "children" => [ "prefix" => "modules/{id}", "slug" => "modules", ], ], ], ]; $res = []; array_walk_recursive($arr, function ($item, $key) use (&$res) { if ($key == 'prefix') { $res[] = $item; } }); echo implode("/", $res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Btfd5
function name:  (null)
number of ops:  14
compiled vars:  !0 = $arr, !1 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   19     2        INIT_FCALL                                               'array_walk_recursive'
          3        SEND_REF                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
   24     6        SEND_VAL                                                 ~4
   19     7        DO_ICALL                                                 
   25     8        INIT_FCALL                                               'implode'
          9        SEND_VAL                                                 '%2F'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $6      
         12        ECHO                                                     $6
         13      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
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 = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/Btfd5
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $item, !1 = $key, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   20     3        IS_EQUAL                                                 !1, 'prefix'
          4      > JMPZ                                                     ~3, ->7
   21     5    >   ASSIGN_DIM                                               !2
          6        OP_DATA                                                  !0
   24     7    > > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.15 ms | 1001 KiB | 15 Q