3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); namespace X; #[\Attribute] class MyAttr { public function __construct(private string $n) {} } #[\AllowDynamicProperties] #[MyAttr('foo')] class Cl { } print_r(array_map(function (\ReflectionAttribute $v) { return class_exists($v->getName(), false) ? $v->newInstance() : $v; }, (new \ReflectionClass(Cl::class))->getAttributes()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Np0NP
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_NS_FCALL_BY_NAME                                    'X%5Cprint_r'
          1        INIT_NS_FCALL_BY_NAME                                    'X%5Carray_map'
          2        DECLARE_LAMBDA_FUNCTION                          ~0      [0]
   19     3        SEND_VAL_EX                                              ~0
          4        NEW                                              $1      'ReflectionClass'
          5        SEND_VAL_EX                                              'X%5CCl'
          6        DO_FCALL                                      0          
          7        INIT_METHOD_CALL                                         $1, 'getAttributes'
          8        DO_FCALL                                      0  $3      
          9        SEND_VAR_NO_REF_EX                                       $3
   15    10        DO_FCALL                                      0  $4      
   19    11        SEND_VAR_NO_REF_EX                                       $4
   15    12        DO_FCALL                                      0          
   19    13      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Np0NP
function name:  X\{closure}
number of ops:  15
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        INIT_NS_FCALL_BY_NAME                                    'X%5Cclass_exists'
          2        INIT_METHOD_CALL                                         !0, 'getName'
          3        DO_FCALL                                      0  $1      
          4        SEND_VAR_NO_REF_EX                                       $1
          5        SEND_VAL_EX                                              <false>
          6        DO_FCALL                                      0  $2      
          7      > JMPZ                                                     $2, ->12
   17     8    >   INIT_METHOD_CALL                                         !0, 'newInstance'
          9        DO_FCALL                                      0  $3      
         10        QM_ASSIGN                                        ~4      $3
         11      > JMP                                                      ->13
   18    12    >   QM_ASSIGN                                        ~4      !0
         13    > > RETURN                                                   ~4
   19    14*     > RETURN                                                   null

End of Dynamic Function 0

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

End of function __construct

End of class X\MyAttr.

Class X\Cl: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.41 ms | 1005 KiB | 16 Q