3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar(Bar $bar) { $bar->baz([$this, 'baz']); } protected function baz() { print 'Foobar!'.PHP_EOL; } } class Bar { public function baz(callable $baz) { $baz(); } } $foo = new Foo; $bar = new Bar; $foo->bar($bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gf0ul
function name:  (null)
number of ops:  10
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   19     3        NEW                                              $5      'Bar'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   21     6        INIT_METHOD_CALL                                         !0, 'bar'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gf0ul
function name:  bar
number of ops:  8
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_METHOD_CALL                                         !0, 'baz'
          2        FETCH_THIS                                       ~1      
          3        INIT_ARRAY                                       ~2      ~1
          4        ADD_ARRAY_ELEMENT                                ~2      'baz'
          5        SEND_VAL_EX                                              ~2
          6        DO_FCALL                                      0          
    5     7      > RETURN                                                   null

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gf0ul
function name:  baz
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'Foobar%21%0A'
    9     1      > RETURN                                                   null

End of function baz

End of class Foo.

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

End of function baz

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.48 ms | 1395 KiB | 13 Q