3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Main { public function run($callable) { $callable(); } } class Foo extends Main { public function test(){ echo 'Foo'; } } class Bar extends Main { public function test(){ echo 'Bar'; } } $function = function(){ $this->test(); }; $foo = new Foo; $bar = new Bar; $foo->run($function); $bar->run($function);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o8YZH
function name:  (null)
number of ops:  15
compiled vars:  !0 = $function, !1 = $foo, !2 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fo8YZH%3A20%240'
          1        ASSIGN                                                   !0, ~3
   24     2        NEW                                              $5      'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   25     5        NEW                                              $8      'Bar'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $8
   27     8        INIT_METHOD_CALL                                         !1, 'run'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
   28    11        INIT_METHOD_CALL                                         !2, 'run'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
         14      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2Fo8YZH%3A20%240

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

End of function run

End of class Main.

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

End of function test

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

End of function run

End of class Foo.

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

End of function test

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

End of function run

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.77 ms | 1399 KiB | 13 Q