3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute] class SomeAttribute { public function __construct (private string $example) { $this->example = $example; } } class SomeClass { #[SomeAttribute("World")] public string $name; public function __construct(string $name) { $this->name = $name; } } $property = new ReflectionProperty(SomeClass::class, 'name'); $properties = $property->getAttributes(); print_r("Hello " . $properties[0]->getArguments()[0] . "\n");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qMWIE
function name:  (null)
number of ops:  18
compiled vars:  !0 = $property, !1 = $properties
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $2      'ReflectionProperty'
          1        SEND_VAL_EX                                              'SomeClass'
          2        SEND_VAL_EX                                              'name'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   24     5        INIT_METHOD_CALL                                         !0, 'getAttributes'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   25     8        INIT_FCALL                                               'print_r'
          9        FETCH_DIM_R                                      ~7      !1, 0
         10        INIT_METHOD_CALL                                         ~7, 'getArguments'
         11        DO_FCALL                                      0  $8      
         12        FETCH_DIM_R                                      ~9      $8, 0
         13        CONCAT                                           ~10     'Hello+', ~9
         14        CONCAT                                           ~11     ~10, '%0A'
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

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

End of function __construct

End of class SomeAttribute.

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

End of function __construct

End of class SomeClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.66 ms | 998 KiB | 14 Q