3v4l.org

run code in 300+ PHP versions simultaneously
<?php readonly class Foobar { public function __construct(public string $foo) {} } try { $reflection = new ReflectionClass(Foobar::class); $obj = $reflection->newInstanceWithoutConstructor(); echo $obj->foo, PHP_EOL; } catch (Throwable $exception) { echo $exception->getMessage(), PHP_EOL, $exception::class, PHP_EOL, implode(PHP_EOL, class_parents($exception)); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 11
Branch analysis from position: 11
2 jumps found. (Code = 107) Position 1 = 12, Position 2 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wn7En
function name:  (null)
number of ops:  28
compiled vars:  !0 = $reflection, !1 = $obj, !2 = $exception
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $3      'ReflectionClass'
          1        SEND_VAL_EX                                              'Foobar'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   10     4        INIT_METHOD_CALL                                         !0, 'newInstanceWithoutConstructor'
          5        DO_FCALL                                      0  $6      
          6        ASSIGN                                                   !1, $6
   11     7        FETCH_OBJ_R                                      ~8      !1, 'foo'
          8        ECHO                                                     ~8
          9        ECHO                                                     '%0A'
         10      > JMP                                                      ->27
   12    11  E > > CATCH                                       last         'Throwable'
   13    12    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         13        DO_FCALL                                      0  $9      
         14        ECHO                                                     $9
         15        ECHO                                                     '%0A'
   14    16        FETCH_CLASS_NAME                                 ~10     !2
         17        ECHO                                                     ~10
         18        ECHO                                                     '%0A'
   15    19        INIT_FCALL                                               'implode'
         20        SEND_VAL                                                 '%0A'
         21        INIT_FCALL                                               'class_parents'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $11     
         24        SEND_VAR                                                 $11
         25        DO_ICALL                                         $12     
         26        ECHO                                                     $12
   16    27    > > RETURN                                                   1

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

End of function __construct

End of class Foobar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.75 ms | 1000 KiB | 15 Q