3v4l.org

run code in 300+ PHP versions simultaneously
<?php # The blueprint for designing creatures for your game interface LivingBeing { public function dealDamage( $idamage); public function takeDamage( $idamage); } class Human implements LivingBeing { private $hp = 150; public function dealDamage( $damage) { } public function takeDamage( $damage) { } } class Elf implements LivingBeing { private $hp = 100; public function dealDamage($damage) { } public function takeDamage($damage) { } } class Dwarf implements LivingBeing { private $hp = 300; public function dealDamage($damage) { } public function takeDamage($damage) { } } # I am a junior dev, I am just going to write this code class Centuar { private $hp = 300; public function dealDamage($opponent) { $opponent->takeDamage(4); } public function takeDamage($damage) { } } class Orc { private $hp = 300; public function dealDamage($damage) { } } $Adam = new Human; $Lucas = new Elf; $Jack = new Dwarf; # Let's fight! $Gabrielle = new Centuar; $Guthakug = new Orc; $Gabrielle->dealDamage($Guthakug);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  (null)
number of ops:  22
compiled vars:  !0 = $Adam, !1 = $Lucas, !2 = $Jack, !3 = $Gabrielle, !4 = $Guthakug
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_CLASS                                            'human'
   19     1        DECLARE_CLASS                                            'elf'
   29     2        DECLARE_CLASS                                            'dwarf'
   61     3        NEW                                              $5      'Human'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $5
   63     6        NEW                                              $8      'Elf'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $8
   65     9        NEW                                              $11     'Dwarf'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $11
   69    12        NEW                                              $14     'Centuar'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !3, $14
   70    15        NEW                                              $17     'Orc'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !4, $17
   72    18        INIT_METHOD_CALL                                         !3, 'dealDamage'
         19        SEND_VAR_EX                                              !4
         20        DO_FCALL                                      0          
         21      > RETURN                                                   1

Class LivingBeing:
Function dealdamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  dealDamage
number of ops:  2
compiled vars:  !0 = $idamage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function dealdamage

Function takedamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  takeDamage
number of ops:  2
compiled vars:  !0 = $idamage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function takedamage

End of class LivingBeing.

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

End of function dealdamage

Function takedamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  takeDamage
number of ops:  2
compiled vars:  !0 = $damage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1      > RETURN                                                   null

End of function takedamage

End of class Human.

Class Elf:
Function dealdamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  dealDamage
number of ops:  2
compiled vars:  !0 = $damage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1      > RETURN                                                   null

End of function dealdamage

Function takedamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  takeDamage
number of ops:  2
compiled vars:  !0 = $damage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1      > RETURN                                                   null

End of function takedamage

End of class Elf.

Class Dwarf:
Function dealdamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  dealDamage
number of ops:  2
compiled vars:  !0 = $damage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   33     1      > RETURN                                                   null

End of function dealdamage

Function takedamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  takeDamage
number of ops:  2
compiled vars:  !0 = $damage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
   36     1      > RETURN                                                   null

End of function takedamage

End of class Dwarf.

Class Centuar:
Function dealdamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  dealDamage
number of ops:  5
compiled vars:  !0 = $opponent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   RECV                                             !0      
   46     1        INIT_METHOD_CALL                                         !0, 'takeDamage'
          2        SEND_VAL_EX                                              4
          3        DO_FCALL                                      0          
   47     4      > RETURN                                                   null

End of function dealdamage

Function takedamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  takeDamage
number of ops:  2
compiled vars:  !0 = $damage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
   50     1      > RETURN                                                   null

End of function takedamage

End of class Centuar.

Class Orc:
Function dealdamage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRS6a
function name:  dealDamage
number of ops:  2
compiled vars:  !0 = $damage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   RECV                                             !0      
   57     1      > RETURN                                                   null

End of function dealdamage

End of class Orc.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.49 ms | 1403 KiB | 13 Q