3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_method($callback) { // inside the callback, $apples will have the value "foo" $callback('apples'); } $oranges = 'bar'; my_method(function($apples) use ($oranges) { echo $oranges.' '.$apples; });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YDbRv
function name:  (null)
number of ops:  7
compiled vars:  !0 = $oranges
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 'bar'
   10     1        INIT_FCALL                                               'my_method'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FYDbRv%3A10%240'
          3        BIND_LEXICAL                                             ~2, !0
   12     4        SEND_VAL                                                 ~2
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Function my_method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YDbRv
function name:  my_method
number of ops:  5
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_DYNAMIC_CALL                                        !0
          2        SEND_VAL_EX                                              'apples'
          3        DO_FCALL                                      0          
    6     4      > RETURN                                                   null

End of function my_method

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.51 ms | 1398 KiB | 14 Q