3v4l.org

run code in 500+ PHP versions simultaneously
<?php class IssuanceScheme { private $lower_1 = 0; private $upper_1 = 20; private $issuanceFee_1 = '15p'; private $lower_2 = 21; private $upper_2 = 30; private $issuanceFee_2 = '12p'; private $lower_3 = 31; private $upper_3 = null; //50; private $issuanceFee_3 = '10p'; private $lower_4 = null; //51; private $upper_4 = null; //75; private $issuanceFee_4 = null; private $lower_5 = null; //76; // no $upper_5 private $issuanceFee_5 = null; public function calculateIssuanceFee($volume) { $issuanceFee = $this->issuanceFee_1; if ($volume >= $this->lower_1 && ($this->upper_1===null || $volume <= $this->upper_1)) { return $this->issuanceFee_1; } if ($volume >= $this->lower_2 && ($this->upper_2===null || $volume <= $this->upper_2)) { return $this->issuanceFee_2; } if ($volume >= $this->lower_3 && ($this->upper_3===null || $volume <= $this->upper_3)) { return $this->issuanceFee_3; } if ($volume >= $this->lower_4 && ($this->upper_4===null || $volume <= $this->upper_4)) { return $this->issuanceFee_4; } if ($volume >= $this->lower_5) { return $this->issuanceFee_5; } } } $issuanceScheme = new IssuanceScheme; // 15p echo sprintf("Passed in: %s, Exp: %s, Got: %s", 0, '15p', $issuanceScheme->calculateIssuanceFee(0)) . PHP_EOL; echo sprintf("Passed in: %s, Exp: %s, Got: %s", 5, '15p', $issuanceScheme->calculateIssuanceFee(5)). PHP_EOL; echo sprintf("Passed in: %s, Exp: %s, Got: %s", 10, '15p', $issuanceScheme->calculateIssuanceFee(10)). PHP_EOL; echo sprintf("Passed in: %s, Exp: %s, Got: %s", 15, '15p', $issuanceScheme->calculateIssuanceFee(15)). PHP_EOL; echo sprintf("Passed in: %s, Exp: %s, Got: %s", 20, '15p', $issuanceScheme->calculateIssuanceFee(20)). PHP_EOL; // 12p echo sprintf("Passed in: %s, Exp: %s, Got: %s", 25, '12p', $issuanceScheme->calculateIssuanceFee(25)). PHP_EOL; echo sprintf("Passed in: %s, Exp: %s, Got: %s", 30, '12p', $issuanceScheme->calculateIssuanceFee(30)). PHP_EOL; // 10p echo sprintf("Passed in: %s, Exp: %s, Got: %s", 50, '10p', $issuanceScheme->calculateIssuanceFee(50)). PHP_EOL; echo sprintf("Passed in: %s, Exp: %s, Got: %s", 60, '10p', $issuanceScheme->calculateIssuanceFee(60)). PHP_EOL; echo sprintf("Passed in: %s, Exp: %s, Got: %s", 75, '10p', $issuanceScheme->calculateIssuanceFee(75)). PHP_EOL; echo sprintf("Passed in: %s, Exp: %s, Got: %s", 100, '10p', $issuanceScheme->calculateIssuanceFee(100)). PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uamib
function name:  (null)
number of ops:  125
compiled vars:  !0 = $issuanceScheme
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   47     0  E >   NEW                                                  $1      'IssuanceScheme'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   50     3        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
          4        SEND_VAL_EX                                                  0
          5        DO_FCALL                                          0  $4      
          6        ROPE_INIT                                         6  ~6      'Passed+in%3A+'
          7        ROPE_ADD                                          1  ~6      ~6, '0'
          8        ROPE_ADD                                          2  ~6      ~6, '%2C+Exp%3A+'
          9        ROPE_ADD                                          3  ~6      ~6, '15p'
         10        ROPE_ADD                                          4  ~6      ~6, '%2C+Got%3A+'
         11        ROPE_END                                          5  ~5      ~6, $4
         12        CONCAT                                               ~9      ~5, '%0A'
         13        ECHO                                                         ~9
   51    14        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
         15        SEND_VAL_EX                                                  5
         16        DO_FCALL                                          0  $10     
         17        ROPE_INIT                                         6  ~12     'Passed+in%3A+'
         18        ROPE_ADD                                          1  ~12     ~12, '5'
         19        ROPE_ADD                                          2  ~12     ~12, '%2C+Exp%3A+'
         20        ROPE_ADD                                          3  ~12     ~12, '15p'
         21        ROPE_ADD                                          4  ~12     ~12, '%2C+Got%3A+'
         22        ROPE_END                                          5  ~11     ~12, $10
         23        CONCAT                                               ~15     ~11, '%0A'
         24        ECHO                                                         ~15
   52    25        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
         26        SEND_VAL_EX                                                  10
         27        DO_FCALL                                          0  $16     
         28        ROPE_INIT                                         6  ~18     'Passed+in%3A+'
         29        ROPE_ADD                                          1  ~18     ~18, '10'
         30        ROPE_ADD                                          2  ~18     ~18, '%2C+Exp%3A+'
         31        ROPE_ADD                                          3  ~18     ~18, '15p'
         32        ROPE_ADD                                          4  ~18     ~18, '%2C+Got%3A+'
         33        ROPE_END                                          5  ~17     ~18, $16
         34        CONCAT                                               ~21     ~17, '%0A'
         35        ECHO                                                         ~21
   53    36        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
         37        SEND_VAL_EX                                                  15
         38        DO_FCALL                                          0  $22     
         39        ROPE_INIT                                         6  ~24     'Passed+in%3A+'
         40        ROPE_ADD                                          1  ~24     ~24, '15'
         41        ROPE_ADD                                          2  ~24     ~24, '%2C+Exp%3A+'
         42        ROPE_ADD                                          3  ~24     ~24, '15p'
         43        ROPE_ADD                                          4  ~24     ~24, '%2C+Got%3A+'
         44        ROPE_END                                          5  ~23     ~24, $22
         45        CONCAT                                               ~27     ~23, '%0A'
         46        ECHO                                                         ~27
   54    47        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
         48        SEND_VAL_EX                                                  20
         49        DO_FCALL                                          0  $28     
         50        ROPE_INIT                                         6  ~30     'Passed+in%3A+'
         51        ROPE_ADD                                          1  ~30     ~30, '20'
         52        ROPE_ADD                                          2  ~30     ~30, '%2C+Exp%3A+'
         53        ROPE_ADD                                          3  ~30     ~30, '15p'
         54        ROPE_ADD                                          4  ~30     ~30, '%2C+Got%3A+'
         55        ROPE_END                                          5  ~29     ~30, $28
         56        CONCAT                                               ~33     ~29, '%0A'
         57        ECHO                                                         ~33
   57    58        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
         59        SEND_VAL_EX                                                  25
         60        DO_FCALL                                          0  $34     
         61        ROPE_INIT                                         6  ~36     'Passed+in%3A+'
         62        ROPE_ADD                                          1  ~36     ~36, '25'
         63        ROPE_ADD                                          2  ~36     ~36, '%2C+Exp%3A+'
         64        ROPE_ADD                                          3  ~36     ~36, '12p'
         65        ROPE_ADD                                          4  ~36     ~36, '%2C+Got%3A+'
         66        ROPE_END                                          5  ~35     ~36, $34
         67        CONCAT                                               ~39     ~35, '%0A'
         68        ECHO                                                         ~39
   58    69        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
         70        SEND_VAL_EX                                                  30
         71        DO_FCALL                                          0  $40     
         72        ROPE_INIT                                         6  ~42     'Passed+in%3A+'
         73        ROPE_ADD                                          1  ~42     ~42, '30'
         74        ROPE_ADD                                          2  ~42     ~42, '%2C+Exp%3A+'
         75        ROPE_ADD                                          3  ~42     ~42, '12p'
         76        ROPE_ADD                                          4  ~42     ~42, '%2C+Got%3A+'
         77        ROPE_END                                          5  ~41     ~42, $40
         78        CONCAT                                               ~45     ~41, '%0A'
         79        ECHO                                                         ~45
   61    80        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
         81        SEND_VAL_EX                                                  50
         82        DO_FCALL                                          0  $46     
         83        ROPE_INIT                                         6  ~48     'Passed+in%3A+'
         84        ROPE_ADD                                          1  ~48     ~48, '50'
         85        ROPE_ADD                                          2  ~48     ~48, '%2C+Exp%3A+'
         86        ROPE_ADD                                          3  ~48     ~48, '10p'
         87        ROPE_ADD                                          4  ~48     ~48, '%2C+Got%3A+'
         88        ROPE_END                                          5  ~47     ~48, $46
         89        CONCAT                                               ~51     ~47, '%0A'
         90        ECHO                                                         ~51
   62    91        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
         92        SEND_VAL_EX                                                  60
         93        DO_FCALL                                          0  $52     
         94        ROPE_INIT                                         6  ~54     'Passed+in%3A+'
         95        ROPE_ADD                                          1  ~54     ~54, '60'
         96        ROPE_ADD                                          2  ~54     ~54, '%2C+Exp%3A+'
         97        ROPE_ADD                                          3  ~54     ~54, '10p'
         98        ROPE_ADD                                          4  ~54     ~54, '%2C+Got%3A+'
         99        ROPE_END                                          5  ~53     ~54, $52
        100        CONCAT                                               ~57     ~53, '%0A'
        101        ECHO                                                         ~57
   63   102        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
        103        SEND_VAL_EX                                                  75
        104        DO_FCALL                                          0  $58     
        105        ROPE_INIT                                         6  ~60     'Passed+in%3A+'
        106        ROPE_ADD                                          1  ~60     ~60, '75'
        107        ROPE_ADD                                          2  ~60     ~60, '%2C+Exp%3A+'
        108        ROPE_ADD                                          3  ~60     ~60, '10p'
        109        ROPE_ADD                                          4  ~60     ~60, '%2C+Got%3A+'
        110        ROPE_END                                          5  ~59     ~60, $58
        111        CONCAT                                               ~63     ~59, '%0A'
        112        ECHO                                                         ~63
   64   113        INIT_METHOD_CALL                                             !0, 'calculateIssuanceFee'
        114        SEND_VAL_EX                                                  100
        115        DO_FCALL                                          0  $64     
        116        ROPE_INIT                                         6  ~66     'Passed+in%3A+'
        117        ROPE_ADD                                          1  ~66     ~66, '100'
        118        ROPE_ADD                                          2  ~66     ~66, '%2C+Exp%3A+'
        119        ROPE_ADD                                          3  ~66     ~66, '10p'
        120        ROPE_ADD                                          4  ~66     ~66, '%2C+Got%3A+'
        121        ROPE_END                                          5  ~65     ~66, $64
        122        CONCAT                                               ~69     ~65, '%0A'
        123        ECHO                                                         ~69
        124      > RETURN                                                       1

Class IssuanceScheme:
Function calculateissuancefee:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 47) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
2 jumps found. (Code = 47) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 32, Position 2 = 39
Branch analysis from position: 32
2 jumps found. (Code = 47) Position 1 = 35, Position 2 = 38
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
2 jumps found. (Code = 46) Position 1 = 45, Position 2 = 52
Branch analysis from position: 45
2 jumps found. (Code = 47) Position 1 = 48, Position 2 = 51
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 55
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 60
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
Branch analysis from position: 52
Branch analysis from position: 38
Branch analysis from position: 39
Branch analysis from position: 25
Branch analysis from position: 26
Branch analysis from position: 12
Branch analysis from position: 13
filename:       /in/uamib
function name:  calculateIssuanceFee
number of ops:  61
compiled vars:  !0 = $volume, !1 = $issuanceFee
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   RECV                                                 !0      
   27     1        FETCH_OBJ_R                                          ~2      'issuanceFee_1'
          2        ASSIGN                                                       !1, ~2
   28     3        FETCH_OBJ_R                                          ~4      'lower_1'
          4        IS_SMALLER_OR_EQUAL                                  ~5      ~4, !0
          5      > JMPZ_EX                                              ~5      ~5, ->13
          6    >   FETCH_OBJ_R                                          ~6      'upper_1'
          7        TYPE_CHECK                                        2  ~7      ~6
          8      > JMPNZ_EX                                             ~7      ~7, ->12
          9    >   FETCH_OBJ_R                                          ~8      'upper_1'
         10        IS_SMALLER_OR_EQUAL                                  ~9      !0, ~8
         11        BOOL                                                 ~7      ~9
         12    >   BOOL                                                 ~5      ~7
         13    > > JMPZ                                                         ~5, ->16
   29    14    >   FETCH_OBJ_R                                          ~10     'issuanceFee_1'
         15      > RETURN                                                       ~10
   31    16    >   FETCH_OBJ_R                                          ~11     'lower_2'
         17        IS_SMALLER_OR_EQUAL                                  ~12     ~11, !0
         18      > JMPZ_EX                                              ~12     ~12, ->26
         19    >   FETCH_OBJ_R                                          ~13     'upper_2'
         20        TYPE_CHECK                                        2  ~14     ~13
         21      > JMPNZ_EX                                             ~14     ~14, ->25
         22    >   FETCH_OBJ_R                                          ~15     'upper_2'
         23        IS_SMALLER_OR_EQUAL                                  ~16     !0, ~15
         24        BOOL                                                 ~14     ~16
         25    >   BOOL                                                 ~12     ~14
         26    > > JMPZ                                                         ~12, ->29
   32    27    >   FETCH_OBJ_R                                          ~17     'issuanceFee_2'
         28      > RETURN                                                       ~17
   34    29    >   FETCH_OBJ_R                                          ~18     'lower_3'
         30        IS_SMALLER_OR_EQUAL                                  ~19     ~18, !0
         31      > JMPZ_EX                                              ~19     ~19, ->39
         32    >   FETCH_OBJ_R                                          ~20     'upper_3'
         33        TYPE_CHECK                                        2  ~21     ~20
         34      > JMPNZ_EX                                             ~21     ~21, ->38
         35    >   FETCH_OBJ_R                                          ~22     'upper_3'
         36        IS_SMALLER_OR_EQUAL                                  ~23     !0, ~22
         37        BOOL                                                 ~21     ~23
         38    >   BOOL                                                 ~19     ~21
         39    > > JMPZ                                                         ~19, ->42
   35    40    >   FETCH_OBJ_R                                          ~24     'issuanceFee_3'
         41      > RETURN                                                       ~24
   37    42    >   FETCH_OBJ_R                                          ~25     'lower_4'
         43        IS_SMALLER_OR_EQUAL                                  ~26     ~25, !0
         44      > JMPZ_EX                                              ~26     ~26, ->52
         45    >   FETCH_OBJ_R                                          ~27     'upper_4'
         46        TYPE_CHECK                                        2  ~28     ~27
         47      > JMPNZ_EX                                             ~28     ~28, ->51
         48    >   FETCH_OBJ_R                                          ~29     'upper_4'
         49        IS_SMALLER_OR_EQUAL                                  ~30     !0, ~29
         50        BOOL                                                 ~28     ~30
         51    >   BOOL                                                 ~26     ~28
         52    > > JMPZ                                                         ~26, ->55
   38    53    >   FETCH_OBJ_R                                          ~31     'issuanceFee_4'
         54      > RETURN                                                       ~31
   40    55    >   FETCH_OBJ_R                                          ~32     'lower_5'
         56        IS_SMALLER_OR_EQUAL                                          ~32, !0
         57      > JMPZ                                                         ~33, ->60
   41    58    >   FETCH_OBJ_R                                          ~34     'issuanceFee_5'
         59      > RETURN                                                       ~34
   44    60    > > RETURN                                                       null

End of function calculateissuancefee

End of class IssuanceScheme.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.16 ms | 2696 KiB | 15 Q