3v4l.org

run code in 300+ PHP versions simultaneously
<?php function apply($a, $f) { foreach ($a as $k => $v) { $f($k, $v); } } $f = function ($v, $k) { var_dump($k, $v); }; $g = function ($v) { var_dump($v); }; $h = 'strlen'; $a = ['a' => 'foo', 'b' => 'noodle', 'c' => 'derp']; apply($a, $f); apply($a, $g); apply($a, $h);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ye37u
function name:  (null)
number of ops:  19
compiled vars:  !0 = $f, !1 = $g, !2 = $h, !3 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FYe37u%3A10%240'
          1        ASSIGN                                                   !0, ~4
   13     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FYe37u%3A13%241'
          3        ASSIGN                                                   !1, ~6
   16     4        ASSIGN                                                   !2, 'strlen'
   18     5        ASSIGN                                                   !3, <array>
   19     6        INIT_FCALL                                               'apply'
          7        SEND_VAR                                                 !3
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0          
   20    10        INIT_FCALL                                               'apply'
         11        SEND_VAR                                                 !3
         12        SEND_VAR                                                 !1
         13        DO_FCALL                                      0          
   21    14        INIT_FCALL                                               'apply'
         15        SEND_VAR                                                 !3
         16        SEND_VAR                                                 !2
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

Function apply:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/Ye37u
function name:  apply
number of ops:  12
compiled vars:  !0 = $a, !1 = $f, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2      > FE_RESET_R                                       $4      !0, ->10
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->10
          4    >   ASSIGN                                                   !3, ~5
    6     5        INIT_DYNAMIC_CALL                                        !1
          6        SEND_VAR_EX                                              !3
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0          
    5     9      > JMP                                                      ->3
         10    >   FE_FREE                                                  $4
    8    11      > RETURN                                                   null

End of function apply

Function %00%7Bclosure%7D%2Fin%2FYe37u%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ye37u
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   12     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FYe37u%3A10%240

Function %00%7Bclosure%7D%2Fin%2FYe37u%3A13%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ye37u
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   15     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FYe37u%3A13%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.96 ms | 1403 KiB | 18 Q