3v4l.org

run code in 300+ PHP versions simultaneously
<?php class induk { protected function alas() { return "Alas"; } protected function miring() { return "Miring"; } } // turunkan class induk ke bagas class anak extends induk { protected function tinggi() { return "Tinggi"; } } // turunkan class bagas ke cucu class cucu extends bagas { protected function luas() { return "Luas"; } public function pewarisan(){ $a = $this->alas(); $b = $this->miring(); $c = $this->tinggi(); $d = $this->luas(); return "$a -> $b -> $c -> $d"; } } // buat objek dari class cucu (instansiasi) $new_pewarisan = new cucu(); //panggil method objek echo $new_pewarisan->pewarisan(); // $new_pewarisan->induk(); // Fatal error: Call to protected method komputer::induk() ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVi65
function name:  (null)
number of ops:  8
compiled vars:  !0 = $new_pewarisan
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   DECLARE_CLASS                                            'cucu', 'bagas'
   35     1        NEW                                              $1      'cucu'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   38     4        INIT_METHOD_CALL                                         !0, 'pewarisan'
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
   42     7      > RETURN                                                   1

Class induk:
Function alas:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVi65
function name:  alas
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   'Alas'
    6     1*     > RETURN                                                   null

End of function alas

Function miring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVi65
function name:  miring
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E > > RETURN                                                   'Miring'
    9     1*     > RETURN                                                   null

End of function miring

End of class induk.

Class anak:
Function tinggi:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVi65
function name:  tinggi
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > RETURN                                                   'Tinggi'
   16     1*     > RETURN                                                   null

End of function tinggi

Function alas:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVi65
function name:  alas
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   'Alas'
    6     1*     > RETURN                                                   null

End of function alas

Function miring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVi65
function name:  miring
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E > > RETURN                                                   'Miring'
    9     1*     > RETURN                                                   null

End of function miring

End of class anak.

Class cucu:
Function luas:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVi65
function name:  luas
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E > > RETURN                                                   'Luas'
   23     1*     > RETURN                                                   null

End of function luas

Function pewarisan:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVi65
function name:  pewarisan
number of ops:  21
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_METHOD_CALL                                         'alas'
          1        DO_FCALL                                      0  $4      
          2        ASSIGN                                                   !0, $4
   27     3        INIT_METHOD_CALL                                         'miring'
          4        DO_FCALL                                      0  $6      
          5        ASSIGN                                                   !1, $6
   28     6        INIT_METHOD_CALL                                         'tinggi'
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !2, $8
   29     9        INIT_METHOD_CALL                                         'luas'
         10        DO_FCALL                                      0  $10     
         11        ASSIGN                                                   !3, $10
   30    12        ROPE_INIT                                     7  ~13     !0
         13        ROPE_ADD                                      1  ~13     ~13, '+-%3E+'
         14        ROPE_ADD                                      2  ~13     ~13, !1
         15        ROPE_ADD                                      3  ~13     ~13, '+-%3E+'
         16        ROPE_ADD                                      4  ~13     ~13, !2
         17        ROPE_ADD                                      5  ~13     ~13, '+-%3E+'
         18        ROPE_END                                      6  ~12     ~13, !3
         19      > RETURN                                                   ~12
   31    20*     > RETURN                                                   null

End of function pewarisan

End of class cucu.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.42 ms | 1390 KiB | 13 Q