3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Vehicle { protected static $wheels = 4; public function wheels() { return get_class($this) . " has " . static::$wheels . " wheels\n"; } } class Bike extends Vehicle { protected static $wheels = 2; } class Car extends Vehicle { protected static $wheels = 4; } class Car_With_Trailer extends Car { protected static $wheels = 6; } $bike = new Bike(); $car = new Car(); $car_with_trailer = new Car_With_Trailer(); print $car->wheels(); print $bike->wheels(); print $car_with_trailer->wheels();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zp59M
function name:  (null)
number of ops:  19
compiled vars:  !0 = $bike, !1 = $car, !2 = $car_with_trailer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $3      'Bike'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   29     3        NEW                                              $6      'Car'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $6
   30     6        NEW                                              $9      'Car_With_Trailer'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $9
   32     9        INIT_METHOD_CALL                                         !1, 'wheels'
         10        DO_FCALL                                      0  $12     
         11        ECHO                                                     $12
   33    12        INIT_METHOD_CALL                                         !0, 'wheels'
         13        DO_FCALL                                      0  $13     
         14        ECHO                                                     $13
   34    15        INIT_METHOD_CALL                                         !2, 'wheels'
         16        DO_FCALL                                      0  $14     
         17        ECHO                                                     $14
         18      > RETURN                                                   1

Class Vehicle:
Function wheels:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zp59M
function name:  wheels
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        CONCAT                                           ~2      ~1, '+has+'
          3        FETCH_STATIC_PROP_R          unknown             ~3      'wheels'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '+wheels%0A'
          6      > RETURN                                                   ~5
   10     7*     > RETURN                                                   null

End of function wheels

End of class Vehicle.

Class Bike:
Function wheels:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zp59M
function name:  wheels
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        CONCAT                                           ~2      ~1, '+has+'
          3        FETCH_STATIC_PROP_R          unknown             ~3      'wheels'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '+wheels%0A'
          6      > RETURN                                                   ~5
   10     7*     > RETURN                                                   null

End of function wheels

End of class Bike.

Class Car:
Function wheels:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zp59M
function name:  wheels
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        CONCAT                                           ~2      ~1, '+has+'
          3        FETCH_STATIC_PROP_R          unknown             ~3      'wheels'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '+wheels%0A'
          6      > RETURN                                                   ~5
   10     7*     > RETURN                                                   null

End of function wheels

End of class Car.

Class Car_With_Trailer:
Function wheels:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zp59M
function name:  wheels
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        CONCAT                                           ~2      ~1, '+has+'
          3        FETCH_STATIC_PROP_R          unknown             ~3      'wheels'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '+wheels%0A'
          6      > RETURN                                                   ~5
   10     7*     > RETURN                                                   null

End of function wheels

End of class Car_With_Trailer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.46 ms | 1428 KiB | 13 Q