3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Function to check if margin is OK or not function check_margin($vpc, $bruto_margin_avg) { if ($vpc >= 1 && $vpc <= 15000) { if ($bruto_margin_avg >= 33 && $bruto_margin_avg <= 40) { //IF VPC is between 0-15000kn and bruto margin is between 33-40% $bruto = 'OK'; $comment = '1'; } else { $bruto = 'NO'; $comment = '33% - 40%'; } } if ($vpc >= 15000 && $vpc <= 50000) { if ($bruto_margin_avg >= 0 && $bruto_margin_avg <= 2) { $bruto = 'OK'; $comment = '2'; } else { $bruto = 'NO'; $comment = '25% - 30%'; } } if ($vpc >= 50000 && $vpc <= 80000) { if ($bruto_margin_avg >= 23 && $bruto_margin_avg <= 27) { $bruto = 'OK'; $comment = '3'; } else { $bruto = 'NO'; $comment = '23% - 27%'; } } if ($vpc > 80000) { if ($bruto_margin_avg > 21) { $bruto = 'OK'; $comment = ''; } else { $bruto = 'NO'; $comment = '> 21%'; } } return array($bruto, $comment); } $vpc = 1560.00; $bruto_margin_avg = 14.952937358001; print_r(check_margin($vpc, $bruto_margin_avg));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lYSRC
function name:  (null)
number of ops:  10
compiled vars:  !0 = $vpc, !1 = $bruto_margin_avg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   ASSIGN                                                   !0, 1560
   50     1        ASSIGN                                                   !1, 14.9529
   51     2        INIT_FCALL                                               'print_r'
          3        INIT_FCALL                                               'check_margin'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function check_margin:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 32
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 47
Branch analysis from position: 37
2 jumps found. (Code = 46) Position 1 = 39, Position 2 = 41
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 45
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 56
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 54
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 56
Branch analysis from position: 49
Branch analysis from position: 56
Branch analysis from position: 41
Branch analysis from position: 47
Branch analysis from position: 36
Branch analysis from position: 30
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
Branch analysis from position: 36
Branch analysis from position: 26
Branch analysis from position: 32
Branch analysis from position: 21
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
Branch analysis from position: 21
Branch analysis from position: 11
Branch analysis from position: 17
Branch analysis from position: 6
filename:       /in/lYSRC
function name:  check_margin
number of ops:  60
compiled vars:  !0 = $vpc, !1 = $bruto_margin_avg, !2 = $bruto, !3 = $comment
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        IS_SMALLER_OR_EQUAL                              ~4      1, !0
          3      > JMPZ_EX                                          ~4      ~4, ->6
          4    >   IS_SMALLER_OR_EQUAL                              ~5      !0, 15000
          5        BOOL                                             ~4      ~5
          6    > > JMPZ                                                     ~4, ->17
    6     7    >   IS_SMALLER_OR_EQUAL                              ~6      33, !1
          8      > JMPZ_EX                                          ~6      ~6, ->11
          9    >   IS_SMALLER_OR_EQUAL                              ~7      !1, 40
         10        BOOL                                             ~6      ~7
         11    > > JMPZ                                                     ~6, ->15
    8    12    >   ASSIGN                                                   !2, 'OK'
    9    13        ASSIGN                                                   !3, '1'
         14      > JMP                                                      ->17
   11    15    >   ASSIGN                                                   !2, 'NO'
   12    16        ASSIGN                                                   !3, '33%25+-+40%25'
   16    17    >   IS_SMALLER_OR_EQUAL                              ~12     15000, !0
         18      > JMPZ_EX                                          ~12     ~12, ->21
         19    >   IS_SMALLER_OR_EQUAL                              ~13     !0, 50000
         20        BOOL                                             ~12     ~13
         21    > > JMPZ                                                     ~12, ->32
   17    22    >   IS_SMALLER_OR_EQUAL                              ~14     0, !1
         23      > JMPZ_EX                                          ~14     ~14, ->26
         24    >   IS_SMALLER_OR_EQUAL                              ~15     !1, 2
         25        BOOL                                             ~14     ~15
         26    > > JMPZ                                                     ~14, ->30
   18    27    >   ASSIGN                                                   !2, 'OK'
   19    28        ASSIGN                                                   !3, '2'
         29      > JMP                                                      ->32
   21    30    >   ASSIGN                                                   !2, 'NO'
   22    31        ASSIGN                                                   !3, '25%25+-+30%25'
   26    32    >   IS_SMALLER_OR_EQUAL                              ~20     50000, !0
         33      > JMPZ_EX                                          ~20     ~20, ->36
         34    >   IS_SMALLER_OR_EQUAL                              ~21     !0, 80000
         35        BOOL                                             ~20     ~21
         36    > > JMPZ                                                     ~20, ->47
   27    37    >   IS_SMALLER_OR_EQUAL                              ~22     23, !1
         38      > JMPZ_EX                                          ~22     ~22, ->41
         39    >   IS_SMALLER_OR_EQUAL                              ~23     !1, 27
         40        BOOL                                             ~22     ~23
         41    > > JMPZ                                                     ~22, ->45
   28    42    >   ASSIGN                                                   !2, 'OK'
   29    43        ASSIGN                                                   !3, '3'
         44      > JMP                                                      ->47
   31    45    >   ASSIGN                                                   !2, 'NO'
   32    46        ASSIGN                                                   !3, '23%25+-+27%25'
   36    47    >   IS_SMALLER                                               80000, !0
         48      > JMPZ                                                     ~28, ->56
   37    49    >   IS_SMALLER                                               21, !1
         50      > JMPZ                                                     ~29, ->54
   38    51    >   ASSIGN                                                   !2, 'OK'
   39    52        ASSIGN                                                   !3, ''
         53      > JMP                                                      ->56
   41    54    >   ASSIGN                                                   !2, 'NO'
   42    55        ASSIGN                                                   !3, '%3E+21%25'
   46    56    >   INIT_ARRAY                                       ~34     !2
         57        ADD_ARRAY_ELEMENT                                ~34     !3
         58      > RETURN                                                   ~34
   47    59*     > RETURN                                                   null

End of function check_margin

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.46 ms | 1407 KiB | 16 Q