3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { function foo() { return 'foo'; } function test($arg) { $f = function () use ($arg) { echo $this->foo() . $arg . PHP_EOL; }; $f(); } } $a = new A(); $a->test('baz');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NmRdQ
function name:  (null)
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   NEW                                                  $1      'A'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   17     3        INIT_METHOD_CALL                                             !0, 'test'
          4        SEND_VAL_EX                                                  'baz'
          5        DO_FCALL                                          0          
          6      > RETURN                                                       1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NmRdQ
function name:  foo
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                       'foo'
    6     1*     > RETURN                                                       null

End of function foo

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NmRdQ
function name:  test
number of ops:  7
compiled vars:  !0 = $arg, !1 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
    9     1        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
          2        BIND_LEXICAL                                                 ~2, !0
          3        ASSIGN                                                       !1, ~2
   12     4        INIT_DYNAMIC_CALL                                            !1
          5        DO_FCALL                                          0          
   13     6      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NmRdQ
function name:  {closure:A::test():9}
number of ops:  7
compiled vars:  !0 = $arg
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                                  !0
   10     1        INIT_METHOD_CALL                                             'foo'
          2        DO_FCALL                                          0  $1      
          3        CONCAT                                               ~2      $1, !0
          4        CONCAT                                               ~3      ~2, '%0A'
          5        ECHO                                                         ~3
   11     6      > RETURN                                                       null

End of Dynamic Function 0

End of function test

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.35 ms | 1995 KiB | 12 Q