3v4l.org

run code in 300+ 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}
number of ops:  8
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   10     1        FETCH_THIS                                       $1      
          2        INIT_METHOD_CALL                                         $1, 'foo'
          3        DO_FCALL                                      0  $2      
          4        CONCAT                                           ~3      $2, !0
          5        CONCAT                                           ~4      ~3, '%0A'
          6        ECHO                                                     ~4
   11     7      > RETURN                                                   null

End of Dynamic Function 0

End of function test

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.21 ms | 1011 KiB | 13 Q