3v4l.org

run code in 300+ PHP versions simultaneously
<?php class car { var $color; var $type; var $series; function car($color="green",$type="bmw",$series="5t") { $mycar->color=$color; $mycar->type=$type; } function what_color() { return $mycar->color; } function what_type() { return $mycar->type; } } function print_vars($obj) { foreach (get_object_vars($obj) as $prop => $val) { echo "\t$prop = $val\n"; } } // instantiate one object $herbie = new Car("white","skoda","3r"); $free=new car("yellow","benz","4f"); $gra=new car("blue","null","2t"); // show herbie properties echo "\herbie: Properties\n"; print_vars($herbie); echo "\free: properties\n"; print_vars($free); echo"\gra: properties\n"; print_vars($gra);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P4T6o
function name:  (null)
number of ops:  31
compiled vars:  !0 = $herbie, !1 = $free, !2 = $gra
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $3      'Car'
          1        SEND_VAL_EX                                              'white'
          2        SEND_VAL_EX                                              'skoda'
          3        SEND_VAL_EX                                              '3r'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $3
   29     6        NEW                                              $6      'car'
          7        SEND_VAL_EX                                              'yellow'
          8        SEND_VAL_EX                                              'benz'
          9        SEND_VAL_EX                                              '4f'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $6
   30    12        NEW                                              $9      'car'
         13        SEND_VAL_EX                                              'blue'
         14        SEND_VAL_EX                                              'null'
         15        SEND_VAL_EX                                              '2t'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !2, $9
   33    18        ECHO                                                     '%5Cherbie%3A+Properties%0A'
   34    19        INIT_FCALL                                               'print_vars'
         20        SEND_VAR                                                 !0
         21        DO_FCALL                                      0          
   35    22        ECHO                                                     '%0Cree%3A+properties%0A'
   36    23        INIT_FCALL                                               'print_vars'
         24        SEND_VAR                                                 !1
         25        DO_FCALL                                      0          
   37    26        ECHO                                                     '%5Cgra%3A+properties%0A'
   38    27        INIT_FCALL                                               'print_vars'
         28        SEND_VAR                                                 !2
         29        DO_FCALL                                      0          
         30      > 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/P4T6o
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
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     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
   23     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
   22    13      > JMP                                                      ->5
         14    >   FE_FREE                                                  $4
   25    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/P4T6o
function name:  car
number of ops:  8
compiled vars:  !0 = $color, !1 = $type, !2 = $series, !3 = $mycar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      'green'
          1        RECV_INIT                                        !1      'bmw'
          2        RECV_INIT                                        !2      '5t'
    9     3        ASSIGN_OBJ                                               !3, 'color'
          4        OP_DATA                                                  !0
   10     5        ASSIGN_OBJ                                               !3, 'type'
          6        OP_DATA                                                  !1
   11     7      > 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/P4T6o
function name:  what_color
number of ops:  3
compiled vars:  !0 = $mycar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~1      !0, 'color'
          1      > RETURN                                                   ~1
   15     2*     > RETURN                                                   null

End of function what_color

Function what_type:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P4T6o
function name:  what_type
number of ops:  3
compiled vars:  !0 = $mycar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~1      !0, 'type'
          1      > RETURN                                                   ~1
   19     2*     > RETURN                                                   null

End of function what_type

End of class car.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.64 ms | 1394 KiB | 18 Q