3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $foo = 5; function getCallable() { return function() { return $this->foo; }; } } $test = new Test(); $callable = $test->getCallable(); echo "Result is ".$callable(); exit(0);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/dmlfv
function name:  (null)
number of ops:  12
compiled vars:  !0 = $test, !1 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   18     3        INIT_METHOD_CALL                                         !0, 'getCallable'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   20     6        INIT_DYNAMIC_CALL                                        !1
          7        DO_FCALL                                      0  $7      
          8        CONCAT                                           ~8      'Result+is+', $7
          9        ECHO                                                     ~8
   22    10      > EXIT                                                     0
         11*     > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fdmlfv%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dmlfv
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'foo'
          2      > RETURN                                                   ~1
   11     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fdmlfv%3A9%240

Class Test:
Function getcallable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dmlfv
function name:  getCallable
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fdmlfv%3A9%240'
   11     1      > RETURN                                                   ~0
   12     2*     > RETURN                                                   null

End of function getcallable

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.67 ms | 1394 KiB | 13 Q