3v4l.org

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

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mh5MZ
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                     'it+can%21'
          1      > RETURN                                                   null

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.75 ms | 1400 KiB | 15 Q