3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $resolver; public function __construct(callable $resolver) { $this->resolver = $resolver; } public function resolve($record) { $this->resolver()($record); } } $test = new Test(function($record) { var_dump($record); }); $test->resolve("hello");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GQ88J
function name:  (null)
number of ops:  9
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Test'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FGQ88J%3A18%240'
   20     2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
   18     4        ASSIGN                                                   !0, $1
   21     5        INIT_METHOD_CALL                                         !0, 'resolve'
          6        SEND_VAL_EX                                              'hello'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FGQ88J%3A18%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GQ88J
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $record
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   20     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FGQ88J%3A18%240

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

End of function __construct

Function resolve:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GQ88J
function name:  resolve
number of ops:  7
compiled vars:  !0 = $record
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_METHOD_CALL                                         'resolver'
          2        DO_FCALL                                      0  $1      
          3        INIT_DYNAMIC_CALL                                        $1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
   14     6      > RETURN                                                   null

End of function resolve

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.25 ms | 1396 KiB | 15 Q