3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cl =function(){ echo 'Im a closure' . PHP_EOL; }; class test { protected $cloure; public function __construct($closure) { $this->closure = $closure; } public function sayWho() { $closure = $this->closure; $closure(); } } $splstorage = new SplObjectStorage(); $test = new test($cl); $splstorage[$test] = $cl; $splstorage[$test]();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7eBbM
function name:  (null)
number of ops:  15
compiled vars:  !0 = $cl, !1 = $splstorage, !2 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7eBbM%3A4%240'
          1        ASSIGN                                                   !0, ~3
   29     2        NEW                                              $5      'SplObjectStorage'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   31     5        NEW                                              $8      'test'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $8
   33     9        ASSIGN_DIM                                               !1, !2
         10        OP_DATA                                                  !0
   35    11        FETCH_DIM_R                                      ~12     !1, !2
         12        INIT_DYNAMIC_CALL                                        ~12
         13        DO_FCALL                                      0          
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F7eBbM%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7eBbM
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'Im+a+closure%0A'
    6     1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F7eBbM%3A4%240

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7eBbM
function name:  __construct
number of ops:  4
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        ASSIGN_OBJ                                               'closure'
          2        OP_DATA                                                  !0
   17     3      > RETURN                                                   null

End of function __construct

Function saywho:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7eBbM
function name:  sayWho
number of ops:  5
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_OBJ_R                                      ~1      'closure'
          1        ASSIGN                                                   !0, ~1
   22     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0          
   23     4      > RETURN                                                   null

End of function saywho

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.5 ms | 1395 KiB | 13 Q