3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { public function geatClosure() { //return 'aaa'; $a = function() { $this->prot(); return 'aaa'; }; return $a; } public function prot() { echo 'bbb'; } } $test = new test; $closure = $test->geatClosure(); echo $closure(); //$closure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ncFjv
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test, !1 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $2      'test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   22     3        INIT_METHOD_CALL                                         !0, 'geatClosure'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   23     6        INIT_DYNAMIC_CALL                                        !1
          7        DO_FCALL                                      0  $7      
          8        ECHO                                                     $7
   24     9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FncFjv%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ncFjv
function name:  {closure}
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_THIS                                       $0      
          1        INIT_METHOD_CALL                                         $0, 'prot'
          2        DO_FCALL                                      0          
    9     3      > RETURN                                                   'aaa'
   10     4*     > RETURN                                                   null

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

Class test:
Function geatclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ncFjv
function name:  geatClosure
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FncFjv%3A7%240'
          1        ASSIGN                                                   !0, ~1
   11     2      > RETURN                                                   !0
   12     3*     > RETURN                                                   null

End of function geatclosure

Function prot:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ncFjv
function name:  prot
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ECHO                                                     'bbb'
   18     1      > RETURN                                                   null

End of function prot

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.02 ms | 1395 KiB | 13 Q