3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $one = ''; public $two = ''; //Constructor public function __construct() { //Constructor } //print variable one public function echoOne() { echo $this->one."\n"; } //print variable two public function echoTwo() { echo $this->two."\n"; } } //Instantiate the object $a = new A(); //Instantiate the reflection object $reflector = new ReflectionClass('A'); //Now get all the properties from class A in to $properties array $properties = $reflector->getProperties(); $i =1; //Now go through the $properties array and populate each property foreach($properties as $property) { echo $property->getName(); echo "\n\n\n\n\n"; //Populating properties $a->{$property->getName()}=$i; //Invoking the method to print what was populated $a->{"echo".ucfirst($property->getName())}()."\n"; $i++; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 33
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 33
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/9hilo
function name:  (null)
number of ops:  35
compiled vars:  !0 = $a, !1 = $reflector, !2 = $properties, !3 = $i, !4 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $5      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $5
   30     3        NEW                                              $8      'ReflectionClass'
          4        SEND_VAL_EX                                              'A'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $8
   33     7        INIT_METHOD_CALL                                         !1, 'getProperties'
          8        DO_FCALL                                      0  $11     
          9        ASSIGN                                                   !2, $11
   35    10        ASSIGN                                                   !3, 1
   37    11      > FE_RESET_R                                       $14     !2, ->33
         12    > > FE_FETCH_R                                               $14, !4, ->33
   39    13    >   INIT_METHOD_CALL                                         !4, 'getName'
         14        DO_FCALL                                      0  $15     
         15        ECHO                                                     $15
   40    16        ECHO                                                     '%0A%0A%0A%0A%0A'
   42    17        INIT_METHOD_CALL                                         !4, 'getName'
         18        DO_FCALL                                      0  $16     
         19        ASSIGN_OBJ                                               !0, $16
         20        OP_DATA                                                  !3
   44    21        INIT_FCALL                                               'ucfirst'
         22        INIT_METHOD_CALL                                         !4, 'getName'
         23        DO_FCALL                                      0  $18     
         24        SEND_VAR                                                 $18
         25        DO_ICALL                                         $19     
         26        CONCAT                                           ~20     'echo', $19
         27        INIT_METHOD_CALL                                         !0, ~20
         28        DO_FCALL                                      0  $21     
         29        CONCAT                                           ~22     $21, '%0A'
         30        FREE                                                     ~22
   46    31        PRE_INC                                                  !3
   37    32      > JMP                                                      ->12
         33    >   FE_FREE                                                  $14
   47    34      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9hilo
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   null

End of function __construct

Function echoone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9hilo
function name:  echoOne
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                      ~0      'one'
          1        CONCAT                                           ~1      ~0, '%0A'
          2        ECHO                                                     ~1
   17     3      > RETURN                                                   null

End of function echoone

Function echotwo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9hilo
function name:  echoTwo
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   FETCH_OBJ_R                                      ~0      'two'
          1        CONCAT                                           ~1      ~0, '%0A'
          2        ECHO                                                     ~1
   23     3      > RETURN                                                   null

End of function echotwo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.2 ms | 1400 KiB | 15 Q