3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { public function foo() { return 1; } public function get($context) { $f = function() { var_dump($this->foo(), static::foo()); return $this->foo() === static::foo(); }; $f->bindTo($context); return $f; } } class Baz { public function foo() { return 2; } } $bar = new Bar; $baz = new Baz; var_dump(call_user_func($bar->get($baz)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q9S8l
function name:  (null)
number of ops:  15
compiled vars:  !0 = $bar, !1 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $2      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   30     3        NEW                                              $5      'Baz'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   32     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'get'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $8      
         10        INIT_USER_CALL                                0          'call_user_func', $8
         11        DO_FCALL                                      0  $9      
         12        SEND_VAR                                                 $9
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FQ9S8l%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q9S8l
function name:  {closure}
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_THIS                                       $0      
          2        INIT_METHOD_CALL                                         $0, 'foo'
          3        DO_FCALL                                      0  $1      
          4        SEND_VAR                                                 $1
          5        INIT_STATIC_METHOD_CALL                                  'foo'
          6        DO_FCALL                                      0  $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
   14     9        FETCH_THIS                                       $4      
         10        INIT_METHOD_CALL                                         $4, 'foo'
         11        DO_FCALL                                      0  $5      
         12        INIT_STATIC_METHOD_CALL                                  'foo'
         13        DO_FCALL                                      0  $6      
         14        IS_IDENTICAL                                     ~7      $5, $6
         15      > RETURN                                                   ~7
   15    16*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FQ9S8l%3A12%240

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

End of function foo

Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q9S8l
function name:  get
number of ops:  8
compiled vars:  !0 = $context, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FQ9S8l%3A12%240'
          2        ASSIGN                                                   !1, ~2
   16     3        INIT_METHOD_CALL                                         !1, 'bindTo'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
   17     6      > RETURN                                                   !1
   18     7*     > RETURN                                                   null

End of function get

End of class Bar.

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

End of function foo

End of class Baz.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.32 ms | 1400 KiB | 15 Q