3v4l.org

run code in 500+ PHP versions simultaneously
<?php define('TAX_RATES', [ 'Single' => [ 'Ranges' => [0, 9700, 39475, 84200, 160725, 204100, 510300], 'MinTax' => [0, 970, 4543, 14382, 32748, 46628, 153798], 'Rates' => [10, 12, 22, 24, 32, 35, 37], ], 'Married_Jointly' => [ 'Ranges' => [0, 19400, 78950, 168400, 321450, 408200, 612350], 'MinTax' => [0, 1940, 9086, 28765, 65497, 93257, 164709], 'Rates' => [10, 12, 22, 24, 32, 35, 37], ], 'Married_Separately' => [ 'Ranges' => [0, 9700, 39475, 84200, 160725, 204100, 306175], 'MinTax' => [0, 970, 4543, 14382.50, 32748.50, 46628.50, 82354.75], 'Rates' => [10, 12, 22, 24, 32, 35, 37], ], 'Head_Household' => [ 'Ranges' => [0, 13850, 52850, 84200, 160700, 204100, 510300], 'MinTax' => [0, 1385, 6065, 12962, 31322, 45210, 152380], 'Rates' => [10, 12, 22, 24, 32, 35, 37], ] ]); $tableTemplate = <<<TABLE <h2>%s</h2> <table border="1"> <tr> <th>Taxable Income</th> <th>Tax Rate</th> </tr> %s </table> TABLE; $rowTemplate = <<<ROW <tr> <td>%s</td> <td>%s%d%%</td> </tr> ROW; foreach (TAX_RATES as $status => $data) { $rows = []; $count = count($data['Rates']); for ($i = 0; $i < $count; ++$i) { $rows[] = sprintf( $rowTemplate, isset($data['Ranges'][$i + 1]) ? '$' . number_format($data['Ranges'][$i] + ($i ? 1 : 0)) . ' - $' . number_format($data['Ranges'][$i + 1]) : "> $" . number_format($data['Ranges'][$i]), $data['MinTax'][$i] ? '$' . number_format($data['MinTax'][$i], 2) . ' + ' : '', $data['Rates'][$i] ); } printf($tableTemplate, $status, implode("\n", $rows)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 82
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 82
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 16
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 43
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 64
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 16
Branch analysis from position: 75
Branch analysis from position: 16
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 16
Branch analysis from position: 75
Branch analysis from position: 16
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 64
Branch analysis from position: 54
Branch analysis from position: 64
Branch analysis from position: 82
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 82
filename:       /in/V97gi
function name:  (null)
number of ops:  84
compiled vars:  !0 = $tableTemplate, !1 = $rowTemplate, !2 = $data, !3 = $status, !4 = $rows, !5 = $count, !6 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'define'
          1        SEND_VAL                                                     'TAX_RATES'
    5     2        SEND_VAL                                                     <array>
    3     3        DO_ICALL                                                     
   26     4        ASSIGN                                                       !0, '%3Ch2%3E%25s%3C%2Fh2%3E%0A%3Ctable+border%3D%221%22%3E%0A++++%3Ctr%3E%0A++++++++%3Cth%3ETaxable+Income%3C%2Fth%3E%0A++++++++%3Cth%3ETax+Rate%3C%2Fth%3E%0A++++%3C%2Ftr%3E%0A%25s%0A%3C%2Ftable%3E'
   37     5        ASSIGN                                                       !1, '++++%3Ctr%3E%0A++++++++%3Ctd%3E%25s%3C%2Ftd%3E%0A++++++++%3Ctd%3E%25s%25d%25%25%3C%2Ftd%3E%0A++++%3C%2Ftr%3E'
   44     6        FETCH_CONSTANT                                       ~10     'TAX_RATES'
          7      > FE_RESET_R                                           $11     ~10, ->82
          8    > > FE_FETCH_R                                           ~12     $11, !2, ->82
          9    >   ASSIGN                                                       !3, ~12
   45    10        ASSIGN                                                       !4, <array>
   46    11        FETCH_DIM_R                                          ~15     !2, 'Rates'
         12        COUNT                                                ~16     ~15
         13        ASSIGN                                                       !5, ~16
   47    14        ASSIGN                                                       !6, 0
         15      > JMP                                                          ->73
   48    16    >   INIT_FCALL                                                   'sprintf'
   49    17        SEND_VAR                                                     !1
   50    18        ADD                                                  ~21     !6, 1
         19        FETCH_DIM_IS                                         ~20     !2, 'Ranges'
         20        ISSET_ISEMPTY_DIM_OBJ                             0          ~20, ~21
         21      > JMPZ                                                         ~22, ->43
   51    22    >   INIT_FCALL                                                   'number_format'
         23        FETCH_DIM_R                                          ~23     !2, 'Ranges'
         24        FETCH_DIM_R                                          ~24     ~23, !6
         25      > JMPZ                                                         !6, ->28
         26    >   QM_ASSIGN                                            ~25     1
         27      > JMP                                                          ->29
         28    >   QM_ASSIGN                                            ~25     0
         29    >   ADD                                                  ~26     ~24, ~25
         30        SEND_VAL                                                     ~26
         31        DO_ICALL                                             $27     
         32        CONCAT                                               ~28     '%24', $27
         33        CONCAT                                               ~29     ~28, '+-+%24'
         34        INIT_FCALL                                                   'number_format'
         35        ADD                                                  ~31     !6, 1
         36        FETCH_DIM_R                                          ~30     !2, 'Ranges'
         37        FETCH_DIM_R                                          ~32     ~30, ~31
         38        SEND_VAL                                                     ~32
         39        DO_ICALL                                             $33     
         40        CONCAT                                               ~34     ~29, $33
         41        QM_ASSIGN                                            ~35     ~34
         42      > JMP                                                          ->50
   52    43    >   INIT_FCALL                                                   'number_format'
         44        FETCH_DIM_R                                          ~36     !2, 'Ranges'
         45        FETCH_DIM_R                                          ~37     ~36, !6
         46        SEND_VAL                                                     ~37
         47        DO_ICALL                                             $38     
         48        CONCAT                                               ~39     '%3E+%24', $38
         49        QM_ASSIGN                                            ~35     ~39
         50    >   SEND_VAL                                                     ~35
   53    51        FETCH_DIM_R                                          ~40     !2, 'MinTax'
         52        FETCH_DIM_R                                          ~41     ~40, !6
         53      > JMPZ                                                         ~41, ->64
         54    >   INIT_FCALL                                                   'number_format'
         55        FETCH_DIM_R                                          ~42     !2, 'MinTax'
         56        FETCH_DIM_R                                          ~43     ~42, !6
         57        SEND_VAL                                                     ~43
         58        SEND_VAL                                                     2
         59        DO_ICALL                                             $44     
         60        CONCAT                                               ~45     '%24', $44
         61        CONCAT                                               ~46     ~45, '+%2B+'
         62        QM_ASSIGN                                            ~47     ~46
         63      > JMP                                                          ->65
         64    >   QM_ASSIGN                                            ~47     ''
         65    >   SEND_VAL                                                     ~47
   54    66        FETCH_DIM_R                                          ~48     !2, 'Rates'
         67        FETCH_DIM_R                                          ~49     ~48, !6
         68        SEND_VAL                                                     ~49
   48    69        DO_ICALL                                             $50     
         70        ASSIGN_DIM                                                   !4
   54    71        OP_DATA                                                      $50
   47    72        PRE_INC                                                      !6
         73    >   IS_SMALLER                                                   !6, !5
         74      > JMPNZ                                                        ~52, ->16
   57    75    >   INIT_FCALL                                                   'printf'
         76        SEND_VAR                                                     !0
         77        SEND_VAR                                                     !3
         78        FRAMELESS_ICALL_2                implode             ~53     '%0A', !4
         79        SEND_VAL                                                     ~53
         80        DO_ICALL                                                     
   44    81      > JMP                                                          ->8
         82    >   FE_FREE                                                      $11
   58    83      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.62 ms | 2438 KiB | 17 Q