3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Test { public $foo = 1; public $bar = 2; public function test() { $class = new ReflectionClass(get_class($this)); $names = array(); foreach($class->getProperties() as $property) { $names[] = $property->getName(); // This code works: // $names[] = $property->name; } return $names; } } $test = new Test(); var_dump($test->test());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a0MFV
function name:  (null)
number of ops:  9
compiled vars:  !0 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   NEW                                                  $1      'Test'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   23     3        INIT_FCALL                                                   'var_dump'
          4        INIT_METHOD_CALL                                             !0, 'test'
          5        DO_FCALL                                          0  $4      
          6        SEND_VAR                                                     $4
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Class Test:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/a0MFV
function name:  test
number of ops:  19
compiled vars:  !0 = $class, !1 = $names, !2 = $property
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   NEW                                                  $3      'ReflectionClass'
          1        FETCH_THIS                                           ~4      
          2        GET_CLASS                                            ~5      ~4
          3        SEND_VAL_EX                                                  ~5
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !0, $3
    9     6        ASSIGN                                                       !1, <array>
   10     7        INIT_METHOD_CALL                                             !0, 'getProperties'
          8        DO_FCALL                                          0  $9      
          9      > FE_RESET_R                                           $10     $9, ->16
         10    > > FE_FETCH_R                                                   $10, !2, ->16
   12    11    >   INIT_METHOD_CALL                                             !2, 'getName'
         12        DO_FCALL                                          0  $12     
         13        ASSIGN_DIM                                                   !1
         14        OP_DATA                                                      $12
   10    15      > JMP                                                          ->10
         16    >   FE_FREE                                                      $10
   17    17      > RETURN                                                       !1
   18    18*     > RETURN                                                       null

End of function test

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
173.42 ms | 2780 KiB | 14 Q