3v4l.org

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

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

End of function wheels

End of class Car.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.89 ms | 1428 KiB | 13 Q