3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] class FooAttribute { function __construct(public string $value) {} } #[FooAttribute('a')] #[FooAttribute('b')] class Foo {} var_dump( array_map( fn ($ar) => $ar->newInstance(), (new ReflectionClass(Foo::class))->getAttributes(FooAttribute::class) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/enf8M
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
   13     1        INIT_FCALL                                               'array_map'
   14     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fenf8M%3A14%240'
          3        SEND_VAL                                                 ~0
   15     4        NEW                                              $1      'ReflectionClass'
          5        SEND_VAL_EX                                              'Foo'
          6        DO_FCALL                                      0          
          7        INIT_METHOD_CALL                                         $1, 'getAttributes'
          8        SEND_VAL_EX                                              'FooAttribute'
          9        DO_FCALL                                      0  $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                         $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                                 
   17    14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fenf8M%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/enf8M
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $ar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        INIT_METHOD_CALL                                         !0, 'newInstance'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fenf8M%3A14%240

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

End of function __construct

End of class FooAttribute.

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.76 ms | 1396 KiB | 17 Q