3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { public $baseFoo = 1; protected $baseBar = 2; } class Foo extends Bar { public $foo = 3; protected $bar = 4; } $foo = new Foo(); $reflect = new ReflectionClass('Foo'); $props = array_filter( $reflect->getProperties(), function($prop){ return $prop->getDeclaringClass()->getName() === Foo::class; }); foreach ($props as $prop) { print $prop->getName() . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/82J7K
function name:  (null)
number of ops:  24
compiled vars:  !0 = $foo, !1 = $reflect, !2 = $props, !3 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $4      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   15     3        NEW                                              $7      'ReflectionClass'
          4        SEND_VAL_EX                                              'Foo'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $7
   16     7        INIT_FCALL                                               'array_filter'
          8        INIT_METHOD_CALL                                         !1, 'getProperties'
          9        DO_FCALL                                      0  $10     
         10        SEND_VAR                                                 $10
         11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F82J7K%3A16%240'
   18    12        SEND_VAL                                                 ~11
         13        DO_ICALL                                         $12     
   16    14        ASSIGN                                                   !2, $12
   20    15      > FE_RESET_R                                       $14     !2, ->22
         16    > > FE_FETCH_R                                               $14, !3, ->22
   21    17    >   INIT_METHOD_CALL                                         !3, 'getName'
         18        DO_FCALL                                      0  $15     
         19        CONCAT                                           ~16     $15, '%0A'
         20        ECHO                                                     ~16
   20    21      > JMP                                                      ->16
         22    >   FE_FREE                                                  $14
   22    23      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F82J7K%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/82J7K
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_METHOD_CALL                                         !0, 'getDeclaringClass'
          2        DO_FCALL                                      0  $1      
          3        INIT_METHOD_CALL                                         $1, 'getName'
          4        DO_FCALL                                      0  $2      
          5        IS_IDENTICAL                                     ~3      $2, 'Foo'
          6      > RETURN                                                   ~3
   18     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F82J7K%3A16%240

Class Bar: [no user functions]
Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.26 ms | 1388 KiB | 15 Q