3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { var_dump($this); } $closure = (new \ReflectionFunction('test'))->getClosure(); $object = new \Exception('oops'); $closure = $closure->bindTo($object, get_class($object)); $closure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HF1Lq
function name:  (null)
number of ops:  19
compiled vars:  !0 = $closure, !1 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $2      'ReflectionFunction'
          1        SEND_VAL_EX                                              'test'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $2, 'getClosure'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !0, $4
    7     6        NEW                                              $6      'Exception'
          7        SEND_VAL_EX                                              'oops'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $6
    8    10        INIT_METHOD_CALL                                         !0, 'bindTo'
         11        SEND_VAR_EX                                              !1
         12        GET_CLASS                                        ~9      !1
         13        SEND_VAL_EX                                              ~9
         14        DO_FCALL                                      0  $10     
         15        ASSIGN                                                   !0, $10
    9    16        INIT_DYNAMIC_CALL                                        !0
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HF1Lq
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    5     4      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.99 ms | 1395 KiB | 15 Q