3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Katana { private $description = 'The katana is characterized by its distinctive appearance: a curved, single-edged blade with a circular or squared guard and long grip to accommodate two hands. Western historians have said that katana were among the finest cutting weapons in world military history.'; private $damage = 30; public function applyDamage() { $damageOutput = $this->damage; // 5% chance of a critical hit. Double the damage. $criticalHit = random_int(1, 100); if ($criticalHit < 5) { $damageOutput *= 2; } return $damageOutput; } public function description() { return $this->description; } } $weapon = new Katana; echo $weapon->applyDamage();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8QpOJ
function name:  (null)
number of ops:  7
compiled vars:  !0 = $weapon
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $1      'Katana'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   28     3        INIT_METHOD_CALL                                         !0, 'applyDamage'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
          6      > RETURN                                                   1

Class Katana:
Function applydamage:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/8QpOJ
function name:  applyDamage
number of ops:  12
compiled vars:  !0 = $damageOutput, !1 = $criticalHit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_R                                      ~2      'damage'
          1        ASSIGN                                                   !0, ~2
   13     2        INIT_FCALL                                               'random_int'
          3        SEND_VAL                                                 1
          4        SEND_VAL                                                 100
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !1, $4
   14     7        IS_SMALLER                                               !1, 5
          8      > JMPZ                                                     ~6, ->10
   15     9    >   ASSIGN_OP                                     3          !0, 2
   18    10    > > RETURN                                                   !0
   19    11*     > RETURN                                                   null

End of function applydamage

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

End of function description

End of class Katana.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.34 ms | 1401 KiB | 15 Q