3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public $prop1 = "I'm a class property!"; public function get() { $a = $this->prop1; $f = function () { return $a; }; return $f(); } } $obj = new MyClass; echo $obj->get();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Hg7pA
function name:  (null)
number of ops:  7
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'MyClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_METHOD_CALL                                         !0, 'get'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
          6      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FHg7pA%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Hg7pA
function name:  {closure}
number of ops:  2
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   !0
   14     1*     > RETURN                                                   null

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

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

End of function get

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.99 ms | 1394 KiB | 13 Q