3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo PHP_VERSION; 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/GmpKn
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     '8.0.0'
   24     1        NEW                                              $1      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   25     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'test'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > 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/GmpKn
function name:  test
number of ops:  19
compiled vars:  !0 = $class, !1 = $names, !2 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     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
   11     6        ASSIGN                                                   !1, <array>
   12     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
   14    11    >   INIT_METHOD_CALL                                         !2, 'getName'
         12        DO_FCALL                                      0  $12     
         13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  $12
   12    15      > JMP                                                      ->10
         16    >   FE_FREE                                                  $10
   19    17      > RETURN                                                   !1
   20    18*     > RETURN                                                   null

End of function test

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.84 ms | 1388 KiB | 15 Q