3v4l.org

run code in 500+ 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 = 24
Branch analysis from position: 24
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:  25
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                                                          ->24
   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                                                   'class_parents'
         20        SEND_VAR                                                     !2
         21        DO_ICALL                                             $11     
         22        FRAMELESS_ICALL_2                implode             ~12     '%0A', $11
         23        ECHO                                                         ~12
   16    24    > > 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.5.0


preferences:
155.49 ms | 1457 KiB | 14 Q