3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 車クラスを作成 class Car { private $km = 0; public function drive($distance) { $this->km += $distance; } public function getKm() { return $this->km; } } // インスタンス化して変数priusに代入 $prius = new Car(); // インスタンスのdriveメソッドへアクセスして引数に80を指定 $prius->drive(80); // 同じくインスタンスのdriveメソッドへアクセスして引数に20を指定 $prius->drive(20); // インスタンスのgetKmメソッドへアクセスして走行距離を出力 print $prius->getKm(); // インスタンス化して変数corollaに代入 $corolla = new Car(); //インスタンスのdriveメソッドへアクセスして引数に50を指定 $corolla->drive(50); // インスタンスのgetKmメソッドへアクセスして走行距離を出力 print $corolla->getKm();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kkbAf
function name:  (null)
number of ops:  22
compiled vars:  !0 = $prius, !1 = $corolla
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'Car'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   21     3        INIT_METHOD_CALL                                         !0, 'drive'
          4        SEND_VAL_EX                                              80
          5        DO_FCALL                                      0          
   24     6        INIT_METHOD_CALL                                         !0, 'drive'
          7        SEND_VAL_EX                                              20
          8        DO_FCALL                                      0          
   27     9        INIT_METHOD_CALL                                         !0, 'getKm'
         10        DO_FCALL                                      0  $7      
         11        ECHO                                                     $7
   30    12        NEW                                              $8      'Car'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $8
   33    15        INIT_METHOD_CALL                                         !1, 'drive'
         16        SEND_VAL_EX                                              50
         17        DO_FCALL                                      0          
   36    18        INIT_METHOD_CALL                                         !1, 'getKm'
         19        DO_FCALL                                      0  $12     
         20        ECHO                                                     $12
         21      > RETURN                                                   1

Class Car:
Function drive:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kkbAf
function name:  drive
number of ops:  4
compiled vars:  !0 = $distance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ_OP                                 1          'km'
          2        OP_DATA                                                  !0
   10     3      > 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/kkbAf
function name:  getKm
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'km'
          1      > RETURN                                                   ~0
   14     2*     > RETURN                                                   null

End of function getkm

End of class Car.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.12 ms | 1386 KiB | 13 Q