3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar; public function setupBar() { $this->bar = function() { echo "inside bar!"; }; } public function callBar() { return $this->bar(); } } $f = new Foo(); $f->setupBar(); $f->callBar(); $f->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BeTu1
function name:  (null)
number of ops:  10
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   18     3        INIT_METHOD_CALL                                         !0, 'setupBar'
          4        DO_FCALL                                      0          
   19     5        INIT_METHOD_CALL                                         !0, 'callBar'
          6        DO_FCALL                                      0          
   20     7        INIT_METHOD_CALL                                         !0, 'bar'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FBeTu1%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BeTu1
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'inside+bar%21'
    9     1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FBeTu1%3A7%240

Class Foo:
Function setupbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BeTu1
function name:  setupBar
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBeTu1%3A7%240'
          1        ASSIGN_OBJ                                               'bar'
    9     2        OP_DATA                                                  ~1
   10     3      > RETURN                                                   null

End of function setupbar

Function callbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BeTu1
function name:  callBar
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_METHOD_CALL                                         'bar'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   14     3*     > RETURN                                                   null

End of function callbar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.82 ms | 1395 KiB | 13 Q