3v4l.org

run code in 300+ PHP versions simultaneously
<?php $closure = (new ReflectionFunction('strlen'))->getClosure()->bindTo(new stdClass()); var_dump($closure('foo'), (new ReflectionFunction($closure))->getClosureThis());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nYdBN
function name:  (null)
number of ops:  24
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $1      'ReflectionFunction'
          1        SEND_VAL_EX                                              'strlen'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $1, 'getClosure'
          4        DO_FCALL                                      0  $3      
          5        INIT_METHOD_CALL                                         $3, 'bindTo'
          6        NEW                                              $4      'stdClass'
          7        DO_FCALL                                      0          
          8        SEND_VAR_NO_REF_EX                                       $4
          9        DO_FCALL                                      0  $6      
         10        ASSIGN                                                   !0, $6
    4    11        INIT_FCALL                                               'var_dump'
         12        INIT_DYNAMIC_CALL                                        !0
         13        SEND_VAL_EX                                              'foo'
         14        DO_FCALL                                      0  $8      
         15        SEND_VAR                                                 $8
         16        NEW                                              $9      'ReflectionFunction'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0          
         19        INIT_METHOD_CALL                                         $9, 'getClosureThis'
         20        DO_FCALL                                      0  $11     
         21        SEND_VAR                                                 $11
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.37 ms | 1395 KiB | 15 Q