3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Car { private $km = 0; public function drive($distance) { $km += $distance; } public function getKm() { return $km; } } $lexus = new Car(); $lexus->drive(5); print $lexus->getKm();
based on L9QJD
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8cfs5
function name:  (null)
number of ops:  11
compiled vars:  !0 = $lexus
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  16     1        NEW                                              $2      :-5
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $2
  17     4        INIT_METHOD_CALL                                         !0, 'drive'
         5        SEND_VAL_EX                                              5
         6        DO_FCALL                                      0          
  18     7        INIT_METHOD_CALL                                         !0, 'getKm'
         8        DO_FCALL                                      0  $6      
         9        ECHO                                                     $6
        10      > RETURN                                                   1

Class Car:
Function drive:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8cfs5
function name:  drive
number of ops:  3
compiled vars:  !0 = $distance, !1 = $km
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   7     0  E >   RECV                                             !0      
   8     1        ASSIGN_ADD                                    0          !1, !0
   9     2      > RETURN                                                   null

End of function drive

Function getkm:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8cfs5
function name:  getKm
number of ops:  2
compiled vars:  !0 = $km
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  12     0  E > > RETURN                                                   !0
  13     1*     > RETURN                                                   null

End of function getkm

End of class Car.

Generated using Vulcan Logic Dumper, using php 7.3.0