3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Car { var $color; function Car($color="green") { $this->color = $color; } function what_color() { return $this->color; } } function print_vars($obj) { foreach (get_object_vars($obj) as $prop => $val) { echo "\t$prop = $val\n"; } } // instantiate one object $herbie = new Car("white"); $free = new car("blue"); // show herbie properties echo "\herbie: Properties\n"; print_vars($herbie); echo "\free: properties\n"; print_vars($free);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gFcdH
function name:  (null)
number of ops:  17
compiled vars:  !0 = $herbie, !1 = $free
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $2      'Car'
          1        SEND_VAL_EX                                              'white'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   21     4        NEW                                              $5      'car'
          5        SEND_VAL_EX                                              'blue'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   24     8        ECHO                                                     '%5Cherbie%3A+Properties%0A'
   25     9        INIT_FCALL                                               'print_vars'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0          
   26    12        ECHO                                                     '%0Cree%3A+properties%0A'
   27    13        INIT_FCALL                                               'print_vars'
         14        SEND_VAR                                                 !1
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Function print_vars:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/gFcdH
function name:  print_vars
number of ops:  16
compiled vars:  !0 = $obj, !1 = $val, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'get_object_vars'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4      > FE_RESET_R                                       $4      $3, ->14
          5    > > FE_FETCH_R                                       ~5      $4, !1, ->14
          6    >   ASSIGN                                                   !2, ~5
   15     7        ROPE_INIT                                     5  ~8      '%09'
          8        ROPE_ADD                                      1  ~8      ~8, !2
          9        ROPE_ADD                                      2  ~8      ~8, '+%3D+'
         10        ROPE_ADD                                      3  ~8      ~8, !1
         11        ROPE_END                                      4  ~7      ~8, '%0A'
         12        ECHO                                                     ~7
   14    13      > JMP                                                      ->5
         14    >   FE_FREE                                                  $4
   17    15      > RETURN                                                   null

End of function print_vars

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

End of function car

Function what_color:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gFcdH
function name:  what_color
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      'color'
          1      > RETURN                                                   ~0
   10     2*     > RETURN                                                   null

End of function what_color

End of class Car.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.49 ms | 1394 KiB | 17 Q