3v4l.org

run code in 300+ PHP versions simultaneously
<?php class bidlogic { public $maxBid; public function getHighestBid() { return $this->maxBid; } public function submitBid($bid) { echo $bid . " - "; if( ($this->getHighestBid() < 50 && $this->getHighestBid() >= 0 && $bid > $this->getHighestBid()+0.50) || ($this->getHighestBid() < 500 && $this->getHighestBid() >= 50 && $bid > $this->getHighestBid()+1) || ($this->getHighestBid() < 1000 && $this->getHighestBid() >= 500 && $bid > $this->getHighestBid()+5) || ($this->getHighestBid() < 5000 && $this->getHighestBid() >= 1000 && $bid > $this->getHighestBid()+10) || ($this->getHighestBid() >= 5000 && $bid > $this->getHighestBid()+50) ){ echo "Pass\n"; } else { echo "Fail\n"; } } } $a = new bidlogic(); $a->maxBid = 5; $a->submitBid(5); $a->submitBid(5.4); $a->submitBid(5.5); $a->submitBid(5.6); $a->maxBid = 50; $a->submitBid(50); $a->submitBid(50.5); $a->submitBid(51); $a->submitBid(51.5);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4OWVG
function name:  (null)
number of ops:  32
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'bidlogic'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        ASSIGN_OBJ                                               !0, 'maxBid'
          4        OP_DATA                                                  5
   26     5        INIT_METHOD_CALL                                         !0, 'submitBid'
          6        SEND_VAL_EX                                              5
          7        DO_FCALL                                      0          
   27     8        INIT_METHOD_CALL                                         !0, 'submitBid'
          9        SEND_VAL_EX                                              5.4
         10        DO_FCALL                                      0          
   28    11        INIT_METHOD_CALL                                         !0, 'submitBid'
         12        SEND_VAL_EX                                              5.5
         13        DO_FCALL                                      0          
   29    14        INIT_METHOD_CALL                                         !0, 'submitBid'
         15        SEND_VAL_EX                                              5.6
         16        DO_FCALL                                      0          
   31    17        ASSIGN_OBJ                                               !0, 'maxBid'
         18        OP_DATA                                                  50
   32    19        INIT_METHOD_CALL                                         !0, 'submitBid'
         20        SEND_VAL_EX                                              50
         21        DO_FCALL                                      0          
   33    22        INIT_METHOD_CALL                                         !0, 'submitBid'
         23        SEND_VAL_EX                                              50.5
         24        DO_FCALL                                      0          
   34    25        INIT_METHOD_CALL                                         !0, 'submitBid'
         26        SEND_VAL_EX                                              51
         27        DO_FCALL                                      0          
   35    28        INIT_METHOD_CALL                                         !0, 'submitBid'
         29        SEND_VAL_EX                                              51.5
         30        DO_FCALL                                      0          
         31      > RETURN                                                   1

Class bidlogic:
Function gethighestbid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4OWVG
function name:  getHighestBid
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_OBJ_R                                      ~0      'maxBid'
          1      > RETURN                                                   ~0
    7     2*     > RETURN                                                   null

End of function gethighestbid

Function submitbid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 47) Position 1 = 18, Position 2 = 33
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
2 jumps found. (Code = 47) Position 1 = 34, Position 2 = 49
Branch analysis from position: 34
2 jumps found. (Code = 46) Position 1 = 38, Position 2 = 42
Branch analysis from position: 38
2 jumps found. (Code = 46) Position 1 = 43, Position 2 = 48
Branch analysis from position: 43
2 jumps found. (Code = 47) Position 1 = 50, Position 2 = 65
Branch analysis from position: 50
2 jumps found. (Code = 46) Position 1 = 54, Position 2 = 58
Branch analysis from position: 54
2 jumps found. (Code = 46) Position 1 = 59, Position 2 = 64
Branch analysis from position: 59
2 jumps found. (Code = 47) Position 1 = 66, Position 2 = 76
Branch analysis from position: 66
2 jumps found. (Code = 46) Position 1 = 70, Position 2 = 75
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 77, Position 2 = 79
Branch analysis from position: 77
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 75
Branch analysis from position: 76
Branch analysis from position: 64
Branch analysis from position: 58
Branch analysis from position: 65
Branch analysis from position: 48
Branch analysis from position: 42
Branch analysis from position: 49
Branch analysis from position: 32
Branch analysis from position: 26
Branch analysis from position: 33
Branch analysis from position: 17
Branch analysis from position: 11
filename:       /in/4OWVG
function name:  submitBid
number of ops:  81
compiled vars:  !0 = $bid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        CONCAT                                           ~1      !0, '+-+'
          2        ECHO                                                     ~1
   11     3        INIT_METHOD_CALL                                         'getHighestBid'
          4        DO_FCALL                                      0  $2      
          5        IS_SMALLER                                       ~3      $2, 50
          6      > JMPZ_EX                                          ~3      ~3, ->11
          7    >   INIT_METHOD_CALL                                         'getHighestBid'
          8        DO_FCALL                                      0  $4      
          9        IS_SMALLER_OR_EQUAL                              ~5      0, $4
         10        BOOL                                             ~3      ~5
         11    > > JMPZ_EX                                          ~3      ~3, ->17
         12    >   INIT_METHOD_CALL                                         'getHighestBid'
         13        DO_FCALL                                      0  $6      
         14        ADD                                              ~7      $6, 0.5
         15        IS_SMALLER                                       ~8      ~7, !0
         16        BOOL                                             ~3      ~8
         17    > > JMPNZ_EX                                         ~3      ~3, ->33
   12    18    >   INIT_METHOD_CALL                                         'getHighestBid'
         19        DO_FCALL                                      0  $9      
         20        IS_SMALLER                                       ~10     $9, 500
         21      > JMPZ_EX                                          ~10     ~10, ->26
         22    >   INIT_METHOD_CALL                                         'getHighestBid'
         23        DO_FCALL                                      0  $11     
         24        IS_SMALLER_OR_EQUAL                              ~12     50, $11
         25        BOOL                                             ~10     ~12
         26    > > JMPZ_EX                                          ~10     ~10, ->32
         27    >   INIT_METHOD_CALL                                         'getHighestBid'
         28        DO_FCALL                                      0  $13     
         29        ADD                                              ~14     $13, 1
         30        IS_SMALLER                                       ~15     ~14, !0
         31        BOOL                                             ~10     ~15
         32    >   BOOL                                             ~3      ~10
         33    > > JMPNZ_EX                                         ~3      ~3, ->49
   13    34    >   INIT_METHOD_CALL                                         'getHighestBid'
         35        DO_FCALL                                      0  $16     
         36        IS_SMALLER                                       ~17     $16, 1000
         37      > JMPZ_EX                                          ~17     ~17, ->42
         38    >   INIT_METHOD_CALL                                         'getHighestBid'
         39        DO_FCALL                                      0  $18     
         40        IS_SMALLER_OR_EQUAL                              ~19     500, $18
         41        BOOL                                             ~17     ~19
         42    > > JMPZ_EX                                          ~17     ~17, ->48
         43    >   INIT_METHOD_CALL                                         'getHighestBid'
         44        DO_FCALL                                      0  $20     
         45        ADD                                              ~21     $20, 5
         46        IS_SMALLER                                       ~22     ~21, !0
         47        BOOL                                             ~17     ~22
         48    >   BOOL                                             ~3      ~17
         49    > > JMPNZ_EX                                         ~3      ~3, ->65
   14    50    >   INIT_METHOD_CALL                                         'getHighestBid'
         51        DO_FCALL                                      0  $23     
         52        IS_SMALLER                                       ~24     $23, 5000
         53      > JMPZ_EX                                          ~24     ~24, ->58
         54    >   INIT_METHOD_CALL                                         'getHighestBid'
         55        DO_FCALL                                      0  $25     
         56        IS_SMALLER_OR_EQUAL                              ~26     1000, $25
         57        BOOL                                             ~24     ~26
         58    > > JMPZ_EX                                          ~24     ~24, ->64
         59    >   INIT_METHOD_CALL                                         'getHighestBid'
         60        DO_FCALL                                      0  $27     
         61        ADD                                              ~28     $27, 10
         62        IS_SMALLER                                       ~29     ~28, !0
         63        BOOL                                             ~24     ~29
         64    >   BOOL                                             ~3      ~24
         65    > > JMPNZ_EX                                         ~3      ~3, ->76
   15    66    >   INIT_METHOD_CALL                                         'getHighestBid'
         67        DO_FCALL                                      0  $30     
         68        IS_SMALLER_OR_EQUAL                              ~31     5000, $30
         69      > JMPZ_EX                                          ~31     ~31, ->75
         70    >   INIT_METHOD_CALL                                         'getHighestBid'
         71        DO_FCALL                                      0  $32     
         72        ADD                                              ~33     $32, 50
         73        IS_SMALLER                                       ~34     ~33, !0
         74        BOOL                                             ~31     ~34
         75    >   BOOL                                             ~3      ~31
         76    > > JMPZ                                                     ~3, ->79
   17    77    >   ECHO                                                     'Pass%0A'
         78      > JMP                                                      ->80
   19    79    >   ECHO                                                     'Fail%0A'
   22    80    > > RETURN                                                   null

End of function submitbid

End of class bidlogic.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.82 ms | 1407 KiB | 13 Q