3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { public function test($closure) { $closure(); } } class Foo { public function foo() { die('test'); } public function test($bar) { $closure = function() { $this->foo(); }; $bar->test($closure); } } $foo = new Foo; $foo->test(new Bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UoYke
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   32     3        INIT_METHOD_CALL                                         !0, 'test'
          4        NEW                                              $4      'Bar'
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $4
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FUoYke%3A23%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UoYke
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   FETCH_THIS                                       $0      
          1        INIT_METHOD_CALL                                         $0, 'foo'
          2        DO_FCALL                                      0          
   25     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FUoYke%3A23%240

Class Bar:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UoYke
function name:  test
number of ops:  4
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        INIT_DYNAMIC_CALL                                        !0
          2        DO_FCALL                                      0          
    9     3      > RETURN                                                   null

End of function test

End of class Bar.

Class Foo:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/UoYke
function name:  foo
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E > > EXIT                                                     'test'
   19     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/UoYke
function name:  test
number of ops:  7
compiled vars:  !0 = $bar, !1 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FUoYke%3A23%240'
          2        ASSIGN                                                   !1, ~2
   26     3        INIT_METHOD_CALL                                         !0, 'test'
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
   27     6      > RETURN                                                   null

End of function test

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.62 ms | 1399 KiB | 13 Q